Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Getting a client and server to agree on UTC time
- Date: Sun, 19 Dec 2010 16:48:38 +0900
- From: Darren Cook <darren@example.com>
- Subject: Re: [tlug] Getting a client and server to agree on UTC time
- References: <4D0DA713.7060006@example.com>
- User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7
> Here's the code I use to get the UTC time on the PHP side. > $utcTime = time() - date("Z"); Because of the User Contributed Notes the PHP manual is a beautiful creature. Check the most recent note on this page: http://php.net/manual/en/function.time.php The first example is exactly what you want: date_default_timezone_set("UTC"); echo "UTC:".time(); (The comment says UTC is the default, but ignore that, as the default actually comes from any of the TZ environment variable, the date.timezone ini option or some query of the OS.) More explanation here: http://php.net/manual/en/function.date-default-timezone-get.php http://php.net/manual/en/function.date-default-timezone-set.php HTH, Darren -- Darren Cook, Software Researcher/Developer http://dcook.org/gobet/ (Shodan Go Bet - who will win?) http://dcook.org/work/ (About me and my work) http://dcook.org/blogs.html (My blogs and articles)
- Follow-Ups:
- References:
- [tlug] Getting a client and server to agree on UTC time
- From: Dave M G
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Getting a client and server to agree on UTC time
- Next by Date: Re: [tlug] Getting a client and server to agree on UTC time [SOLVED]
- Previous by thread: Re: [tlug] Getting a client and server to agree on UTC time
- Next by thread: Re: [tlug] Getting a client and server to agree on UTC time [SOLVED]
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links