| ||||||
|
How to convert a PHP timestamp into a human readable format
Timestamps are great for the following reason. They can be converted into any chosen format without having to do much pre-converting. This saves a lot of time compared to times and dates stored in human readable formats. How then do you convert a timestamp into something human readable? In PHP the function for this job is strftime: strftime(format, timestamp); To establish the format we can use alphanumeric values that are then translated into the appropriate data. Here is an example converting the unix code 1238706731 into 02 Apr 2009: echo strftime("%d %b %Y", 1238706731); Here is a list of format codes:
|