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
Share on other sites

  • 5 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.