Jump to content

[SOLVED] EPOCH TIME PHP and MYSQL


siezma

Recommended Posts

Hello,

I have implemented a tag cloud widget for my application. Everything works fine except the creation date. The widget gets the data from xml file. You can see some data below;

 

<?xml version="1.0" encoding="UTF-8"?>
<response>
<tags>
	<tag created="1171020448890" freq="170" rank="100" tagtitle="photography" />
	<tag created="1171111779109" freq="136" rank="80" tagtitle="nightNikon" />
	<tag created="1171020449328" freq="80" rank="47" tagtitle="macro" />
	<tag created="1171020449015" freq="79" rank="46" tagtitle="flickr" />
	<tag created="1171020448890" freq="78" rank="45" tagtitle="lattimore" />
</tags>
</response>

 

I have created a table including created field as a datetime format. And when i am fetching it from the database, I am using the sql below;

 

SELECT UNIX_TIMESTAMP(created) AS utimestamp,freq,rank,tagtitle FROM tag ORDER BY freq DESC LIMIT 100

 

But when the application shows the date, it shows "1/14/1970" or something like that. Also returning timestamp is 10 digits from mysql, but the timestamp which widget using is 13 digits. I am not good at time at php. What i am doing wrong? What is this EPOCH time?

 

Note: This is not a 3rd party app problem. My question and problem is not about the widget.The problem is about php and mysql date functions. So pls don't tell me to send it under 3rd party app!

 

 

Link to comment
https://forums.phpfreaks.com/topic/68547-solved-epoch-time-php-and-mysql/
Share on other sites

  • 5 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.