I am building an email which will be used via a web form to transmit data to a mailbox. I am looking to timestamp the XML portion of the email using ISO 8601 format. I need to get the time the email is sent then convert it all using PHP. Any ideas?
+1
A:
date('c')
will output the current server time in iso8601. If you're looking to read in a date, you can pass a timestamp into the function like this
date('c',strtotime('January 4th 2001 4:30pm'))
where the argument for strtotime is just about any english readable text representation of a date.
yaauie
2009-01-12 19:03:48
A:
Okay...tried it but it won't display anything. I used date('c'). Nothing came up. LOL Sorry...newbie here!!
you should write the answer to yaauie's response in a comment to it or edit your initial question
Karsten
2009-01-12 19:19:10
A:
The format Y-m-d\TH:i:sO
is the same as c
. Since PHP 5.1.1 there is the constant DATE_ISO8601
holding this value.
Gumbo
2009-01-12 19:41:10