Recipe 3.3. Converting an Epoch Timestamp to Time and Date Parts


3.3.1. Problem

You want the set of time and date parts that corresponds to a particular epoch timestamp.

3.3.2. Solution

Pass an epoch timestamp to getdate( ): $time_parts = getdate(163727100);.

3.3.3. Discussion

The time parts returned by getdate( ) are detailed in Table 3-1. These time parts are in local time. If you want time parts in another time zone corresponding to a particular epoch timestamp, see Recipe 3.11.

3.3.4. See Also

Recipe 3.2 for how to convert time and date parts back to epoch timestamps; Recipe 3.11 for how to deal with time zones; documentation on getdate( ) at http://www.php.net/getdate .




PHP Cookbook, 2nd Edition
PHP Cookbook: Solutions and Examples for PHP Programmers
ISBN: 0596101015
EAN: 2147483647
Year: 2006
Pages: 445

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net