Placeholder date format
4 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: December 12, 2013 (RSS)
By Toledoh - December 12, 2013
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");
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!
interactivetools.com
By Toledoh - December 12, 2013
Thanks Dave,
I might take this back through consulting.
Tim (toledoh.com.au)
By Dave - December 12, 2013
Just send a link to this forum post and it shouldn't take them more than a few minutes.
interactivetools.com