Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: TheCase on October 03, 2008, 04:37:32 PM

Title: Date Format
Post by: TheCase on October 03, 2008, 04:37:32 PM
Hi,

SMF does the date as numbers like 343829 whats the PHP code for converting this in date and time

Thanks
Title: Re: Date Format
Post by: Nathaniel on October 03, 2008, 09:00:03 PM
If you are trying to convert the unix timestamp (http://en.wikipedia.org/wiki/Unix_time) into date/time, with the same format as shown around your forum, then you can use SMF's 'timeformat() (http://support.simplemachines.org/function_db/index.php?action=view_function;id=215)' function.

PHP itself, has a series of Date/Time Functions (http://au.php.net/manual/en/ref.datetime.php). So you can use the PHP 'date()' (http://au.php.net/date) function to convert from a timestamp to the time/date format that you want (if you don't like the SMF one), and the 'strtotime() (http://au.php.net/manual/en/function.strtotime.php)' function to convert from a date/time to a unix timestamp.