943,800 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 489
  • PHP RSS
Sep 8th, 2009
0

Time Stamp

Expand Post »
How do I make the timestamp string be displayed as something that is actually readable / understandable? Yes, I have looked on google, here and a couple other places, but I am not seeing anything too specific or I am just not understand. Thank you for your understanding, helping me out and not being too critical.

Here is what I have:

In the database:
timestamp int(11) unsigned

and it inserts it like this:
1252386167

Using Php to display Last Active it displays it like this:
1252410826

Thank you,
Similar Threads
Vai
Reputation Points: 12
Solved Threads: 5
Junior Poster in Training
Vai is offline Offline
74 posts
since Jan 2008
Sep 8th, 2009
1

Re: Time Stamp

Here is a customised function I use:

PHP Syntax (Toggle Plain Text)
  1. function EpochDate($timestamp, $format = "Y-m-d H:i:s")
  2. {
  3. $final_timestamp = date($format, mktime(0 , 0, $timestamp, 1, 1, 1970));
  4. return($final_timestamp);
  5. }

you would then call EpochDate("1252386167")
You could call EpochDate("1252386167", "d m Y H:i") or whatever suits for a different date format
Reputation Points: 14
Solved Threads: 10
Junior Poster in Training
SimonMayer is offline Offline
53 posts
since Apr 2008
Sep 8th, 2009
0

Re: Time Stamp

thank you..
Vai
Reputation Points: 12
Solved Threads: 5
Junior Poster in Training
Vai is offline Offline
74 posts
since Jan 2008
Sep 8th, 2009
0

Re: Time Stamp

I was too slow on this, but use the date() function.

http://us.php.net/manual/en/function.date.php
Reputation Points: 10
Solved Threads: 2
Light Poster
Rkeast is offline Offline
33 posts
since Aug 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Customizable Object
Next Thread in PHP Forum Timeline: Problem with PDFLib





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC