You need to sign in to do that
Don't have an account?
peterppt
Formatting SF DateTime in php
Is there a simple way to format a date and time currently displayed as 2012-11-06T23:00:00.000Z as dd/mm/yyyy hh:mm ? I've looked at various php formatting functions but can't find one suitable. I could do this by string manipulation but hope there is a simpler approach !
Thanks
You can use a combination of PHP's strtotime and date functions.
You can find information on PHP's date function (including formatting string parameters) at http://www.php.net/manual/en/function.date.php. Note that you might need to use gmdate instead which returns a GMT datetime. Change the 'G' to a 'g' if you want to display the time in 12 hour format instead of 24 hour format, and you can use an 'a' or 'A' at the end if you want to add the am/pm or AM/PM to the end.
All Answers
You can use a combination of PHP's strtotime and date functions.
You can find information on PHP's date function (including formatting string parameters) at http://www.php.net/manual/en/function.date.php. Note that you might need to use gmdate instead which returns a GMT datetime. Change the 'G' to a 'g' if you want to display the time in 12 hour format instead of 24 hour format, and you can use an 'a' or 'A' at the end if you want to add the am/pm or AM/PM to the end.
Thanks - I'd done it by some rather crude string manipulation. This is the elegant solution I'd hope for.
Thanks again.