Categories > TinyButStrong general (FR) >

[fr] Timestamp "dans l'ordre"

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: maxx-out
Date: 2003-06-27
Time: 10:04

[fr] Timestamp "dans l'ordre"

Bonjour,

Je récupère un timestamp par mysql (sous la forme aaaammjj) et je voudrais pouvoir l'afficher sous la forme jj/mm/aaaa sans recourir à des accrobatie du genre SELECT CONCAT (RIGHT(LEFT(date,2)),"/",RIGHT(LEFT(date,2)),"/",LEFT(date,4))....

Quelqu'un voit il une astuce qui m'aurait échappé ?

Merci !
By: Skrol29
Date: 2003-06-27
Time: 10:33

Re: [fr] Timestamp

salut,

Il suffit de faire :
SELECT DATE_FORMAT(ts_field, '%Y-%m-%d %T') AS Date FROM ...
By: maxx-out
Date: 2003-06-27
Time: 10:51

Re: [fr] Timestamp

Arf...

Je me pose des problèmes de manière tout à fait tordue parfois...

Et c'était si simple !

Merci !
By: (translation)
Date: 2003-06-27
Time: 10:59

Re: [fr] Timestamp

This is a small translation of the current thread.

maxx-out:
------------------------------------
I get a timestamp from MySQL (which as the format yyyymmdd) and I like to display it with the format dd/mm/yyyy wihtout using heavy stuff like SELECT CONCAT (RIGHT(LEFT(date,2)),"/",RIGHT(LEFT(date,2)),"/",LEFT(date,4))....
------------------------------------

Skrol29:
------------------------------------
Just use
SELECT DATE_FORMAT(ts_field, '%Y-%m-%d %T') AS MyDate FROM ...
------------------------------------