Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

How do I convert datetime to ISO 8601 in smarty

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
smowtion
Smarty n00b


Joined: 13 Mar 2013
Posts: 4

PostPosted: Tue Apr 22, 2014 2:24 pm    Post subject: How do I convert datetime to ISO 8601 in smarty Reply with quote

How do I convert my time to ISO 8601 date format?
in php
Code:

$datetime = new DateTime('2010-12-30 23:21:46');

echo $datetime->format(DateTime::ISO8601);

or
Code:
echo date("c",time());

Can i do it in smarty with date_format
Thanks
Back to top
View user's profile Send private message
smowtion
Smarty n00b


Joined: 13 Mar 2013
Posts: 4

PostPosted: Tue Apr 22, 2014 2:37 pm    Post subject: Reply with quote

sorry
I founded a solution
Code:
{"c"|date:$smarty.now}

close
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Apr 23, 2014 3:38 am    Post subject: Reply with quote

you might also try:

{$smarty.now|date_format:"c"}

date_format will support date() formats as well as strftime(). If there are no "%" chars, date() is assumed.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP