Gossamer Forum
Home : Products : Gossamer Mail : Discussion :

transform_date($msgs_sent, ".....")?

Quote Reply
transform_date($msgs_sent, ".....")?
Hello All:

Please help:
How can I use transform_date($msgs_sent, "......")to get for example: Jan 9

Thank you, pcurran
Quote Reply
Re: [pyc] transform_date($msgs_sent, ".....")? In reply to
transform_date is defined as a global as:
Code:
transform_date($date, $new_format, $new_year_format)
$date is the date that needs to be transformed (this should be in the date_user_format set in the admin - most dates should already be in this format)
$new_format is the format you wish to format the date (more on this later)
$new_year_format is optional. This is the format of the date to use if the date is not in the current year (eg. if the date is from 2003, then this format will be used)

You can use the following to change the format of the date:
Code:
# yyyy - four digit year as in 1999
# yy - two digit year as in 99
# y - two digit year without leading 0
# mmmm - long month name as in January
# mmm - short month name as in Jan
# mm - numerical month name as in 01
# m - same as mm, but without leading 0's for months 1-9
# dddd - long day name as in Sunday
# ddd - short day name as in Sun
# dd - numerical date
# d - numerical date without leading 0
# HH - numerical hours (24 hour time)
# H - numerical hours without leading 0 (24 hour time)
# hh - numerical hours (12 hour time)
# h - numerical hours without leading 0 (12 hour time)
# MM - numerical minutes
# M - numerical minutes without leading 0
# ss - numerical seconds
# s - numerical seconds without leading 0
# tt - AM or PM (use with 12 hour time)
# o - + or - gm offset
#
# Common formats:
# %yyyy%-%mm%-%dd% 1999-12-25
# %dd%-%mmm%-%yyyy% 12-Dec-1999
# %ddd% %mmm% %dd% %yyyy% Sat Dec 12 1999
# %ddd% %mmm% %dd% %yyyy% Sat Dec 12 1999
#
# RFC822
# %ddd%, %dd% %mmm% %yyyy% %HH%:%MM%:%ss% %o% Sat, 12, Dec 1999 21:32:02 -0800
#
# MySQL
# %yyyy%-%mm%-%dd% %HH%:%MM%:%ss% 1999-03-25 21:32:02
This is pasted straight from GT::Date, but this is also available in the admin => Setup => Date help.

So for Jan 9, you would have a format of "%mmm% %d%"

Adrian
Quote Reply
Re: [pyc] transform_date($msgs_sent, ".....")? In reply to
Hello Adrian:
Thanks for the solution; its working fine.
pcurran