tags:

views:

64

answers:

5

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: 

php manual - date

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
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
A: 

which php version do you use?

date('c');

has been added in php5.

Karsten
A: 

php 4 Anything for 4?

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