Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to convert epoch time to human readable time

Posted on 2007-12-01
5
Medium Priority
?
6,386 Views
Last Modified: 2013-12-13
Hi,

I like to know if there is a function or method anyone would know in PHP that converts epoch time to human readable time.

Thanks
0
Comment
Question by:dmehran
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 21

Accepted Solution

by:
nizsmo earned 2000 total points
ID: 20390017
There sure is, please use the date function, like this as an example:

<?php
      echo date("Y-m-d","1196559376");
?>
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20390022
More information on the date() function here:
http://www.php.net/date

basically you supply a string as the first argument, and your epoch time as your second argument.

To get the full deal something like this would display the time as well:

<?php
      echo date("Y-m-d H:i:s","1196559376");
?>

Hope this helps, to get more examples on what string you should use in the first argument, please refer to the site above.
0
 

Author Closing Comment

by:dmehran
ID: 31412151
Oh my, I am not sure how this slipped under my radar! For whatever reason I was thinking of something way more complicated than passing couple of arguments to the date function.

Thanks
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20394427
no problem glad to help! :)
0
 
LVL 1

Expert Comment

by:a2liter
ID: 20725683
Here is a handy function that I use all the time, you cna just add formats to return to your hearts content. These are just the most common ones that I use.


function sec2date($ticks,$method = 1){
 if ($method == 1)
  $date= date("Y-m-d H:i:s", $ticks);
 else if ($method == 2)
  $date= date("m/d/y H:i:s", $ticks);
 return $date;
}

Open in new window

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question