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

transformer le format d'une date timestamp

 
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 -> Language: French
View previous topic :: View next topic  
Author Message
ausmarty
Smarty n00b


Joined: 02 Sep 2009
Posts: 1

PostPosted: Wed Sep 02, 2009 1:43 pm    Post subject: transformer le format d'une date timestamp Reply with quote

Bonjour à tous.
Dans le fichier tpl de mon logiciel, j'ai
{issue.opened}
cela récupère l'heure dans la table au format timestamp.
Pour le mettre au format date j'ai mis:
{php}date('d m Y H:i',{issue.opened}){/php}

mais ça ne fonctionne pas. Pourriez vous m'aider svp.

Merci
Back to top
View user's profile Send private message
leoz
Smarty n00b


Joined: 02 Sep 2009
Posts: 1

PostPosted: Thu Sep 03, 2009 12:45 pm    Post subject: Reply with quote

Utilise la fonction mktime Wink
Back to top
View user's profile Send private message
Gowser
Smarty Pro


Joined: 19 Feb 2008
Posts: 104
Location: Nantes (France)

PostPosted: Thu Sep 10, 2009 2:08 pm    Post subject: Reply with quote

Bonjour,

Il y a 2 solutions pour ce problème :

La façon dégueulasse :

Code:

{assign var='dateConvert' value=$issue.opened}
{php}date('d m Y H:i', $this->get_template_vars('dateConvert')){/php}


La façon propre :

Code:

{$issue.opened|date_format:'%d %m %Y %H:%M'}


Quote:

date_format

Formate une date / heure au format strftime() donné. Les dates peuvent être passées à smarty en tant que timestamp unix, timestamp mysql ou comme chaîne quelconque contenant mois jour année (interprétable par strtotime()).


Voilou, ++
Back to top
View user's profile Send private message Send e-mail
Juliano
Smarty n00b


Joined: 20 Apr 2014
Posts: 1

PostPosted: Sun Apr 20, 2014 10:20 pm    Post subject: merci Reply with quote

Salut mec, j'ai 5 ans de retard sur ta réponse et tu verra sûrement jamais la mienne mais merci infiniment sa faisait des semaines que je cherchais ce code !

Encore merci Laughing
Back to top
View user's profile Send private message
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 -> Language: French 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