function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ssuede7ssuede7 

Format datetime for display in PHP

Hi,

 

This must be really simple because I can't find any example of how to do this.  All I want to do is make my datetimes look nice.  Here is what I get out of my query results object: 

 

2009-09-04T06:43:36.000Z

 

And I would like to format it like this:

 

 

09/04/2009, 12:43 PM

 

Can anyone clue me in? 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
ptepperptepper

You can use strtotime to convert to Unix time and then date to format it, or use a regular expression to parse the SF datetime.

 

http://us.php.net/manual/en/function.strtotime.php

 

http://us.php.net/manual/en/function.date.php

All Answers

ptepperptepper

You can use strtotime to convert to Unix time and then date to format it, or use a regular expression to parse the SF datetime.

 

http://us.php.net/manual/en/function.strtotime.php

 

http://us.php.net/manual/en/function.date.php

This was selected as the best answer
ssuede7ssuede7

Thanks ptepper!  That was all I needed!