Placeholder date format

Hi Guys,

When using the #order.createdDate# placeholder, the date is generated as "2013-12-13 08:37:01"

Is there any way to format that such as date("F j, Y, g:i a");

Cheers,

Tim (toledoh.com.au)

By Dave - December 12, 2013

Hi Tim, 

The #order.createdDate# placeholder sounds like it's from some custom code we've done.

This format of date "2013-12-13 08:37:01 is what is returned by MySQL.  So what you need to do is find the place in the code where order.createdDate is set and add another placeholder, such as order.createdDate2.

Here's some code to reformat a date: 

$date = "2013-12-13 08:37:01";
$date2 = date("F j, Y, g:i a", strtotime($date)); 
print $date2;  // outputs: December 13, 2013, 8:37 am
exit;

And if you were to do that in one line to set a new placeholder it might look something like this:

$placeholders['order.createdDate2'] = date("F j, Y, g:i a", strtotime( $order['createdDate'] )); 

Let me know any questions!

Dave Edis - Senior Developer
interactivetools.com

Thanks Dave,

I might take this back through consulting.

Cheers,

Tim (toledoh.com.au)