Page 1 of 1

Convert UTC time to Local time

Posted: Thu Sep 16, 2004 2:37 pm
by dave914
How do I take a Zulu/GMT/UTC time like 1643 and convert it to a local time like 8:00PM? Also, how would I convert a Zulu/GMT/UTC time like 1643 to a UNIX timestamp? Do I need to know the month, day, and year before I can convert the UTC time to a local time?? I'm so confused. I'm thinking I may need to use gmmktime, but I'm not really sure. Please include a code snippet. Thanks.

Posted: Thu Sep 16, 2004 2:49 pm
by feyd
wouldn't that be 4:43PM ?

anyways.. you can use a regular expression to extract the numbers out. Then pass them to gmmktime.

You can look here for information on regular expressions.

Posted: Thu Sep 16, 2004 3:02 pm
by dave914
How do I pass the numbers to gmmktime? Can you give me an example? I know how to extract the numbers out using a regex, but how do they get passed to gmmktime? Also, do I have to pass a day, month, and year to gmmktime?

Posted: Thu Sep 16, 2004 3:05 pm
by John Cartwright
have you looked at

[php_man]gmmktime[/php_man]

Posted: Thu Sep 16, 2004 3:08 pm
by feyd
I don't quite see how you wouldn't know how to pass data to a function if you know how to extract the information with a regular expression... and yes, you need to pass the date.