Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Change the format of Timestmp

Quote Reply
Change the format of Timestmp
Can I change with a global the look of the Timestmp value
Now the data look like this-
2011-12-04 14:02:02
and I need it look like this
12/04 | 14:02
Quote Reply
Re: [nir] Change the format of Timestmp In reply to
Totally untested, but try this in the template:

Code:
<%GT::Template::date_transform($Add_Date,"%yyyy%-%mm%-%dd% %HH%:%MM%:%ss%","%mm%/%dd% | %HH%:%MM%")%>

(I'm not sure if its <%Add_Date%> you are trying to format - so just replace $Add_Date to whatever tag it is you wanna use)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Change the format of Timestmp In reply to
I get this error
Error: Unable to load module 'GT::Template':

Error: No subroutine 'GT::Template::date_transform' in 'GT/Template.pm',
Quote Reply
Re: [nir] Change the format of Timestmp In reply to
Oops, serves me right for rushing :) Its GT::Date you want:

Code:
<%GT::Date::date_transform($Add_Date,"%yyyy%-%mm%-%dd% %HH%:%MM%:%ss%","%mm%/%dd% | %HH%:%MM%")%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Change the format of Timestmp In reply to
Thanks, It work, there is a small bug that it display other data than it show in the database.
it don't do it for all the dataWhistle
I have
2011-12-04 17:00:02
and it display
11/15 | 11:34
Quote Reply
Re: [nir] Change the format of Timestmp In reply to
MMm you sure? I just tested it on GLinks 3.2.0, and it works:

Code:
<%GT::Date::date_transform("2011-12-04 17:00:02 ","%yyyy%-%mm%-%dd% %HH%:%MM%:%ss%","%mm%/%dd% | %HH%:%MM%")%>

..gives me:

Quote:
12/04 | 17:00

Are you sure the value you are passing in is right?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Change the format of Timestmp In reply to
You are right it was my mistake.
ThanksSmile