<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City" /><o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place" /><o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName" /><!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]--><style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Bookman Old Style";
        panose-1:2 5 6 4 5 5 5 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
pre
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:Arial;
        color:navy;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="Section1">
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">As I thought about this I realized my interpretation of the data was wrong. <o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">28800 is the time it was GMT when it was January 1 1970 00 in
<st1:City w:st="on"><st1:place w:st="on">Los Angeles</st1:place></st1:City>. So in some senses maybe that’s the time that you want, and your solution is correct. If you tack on the users time zone you will get the number of seconds it was away from
</span></font><font size="2" color="#0000c0" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";color:#0000C0">'January 1 1970 GMT’.
</span></font><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:navy"><o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">I’d go ahead and experiment with this January 1 1970 date and see if your solution works for the user entered time zones you provide.
<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">
<hr size="2" width="100%" align="center" tabindex="-1">
</span></font></div>
<p class="MsoNormal"><b><font size="2" face="Tahoma"><span style="font-size:10.0pt;
font-family:Tahoma;font-weight:bold">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size:10.0pt;font-family:Tahoma"> support-bounces@drupal.org [mailto:support-bounces@drupal.org]
<b><span style="font-weight:bold">On Behalf Of </span></b>Metzler, David<br>
<b><span style="font-weight:bold">Sent:</span></b> Thursday, February 28, 2013 8:38 AM<br>
<b><span style="font-weight:bold">To:</span></b> '<st1:PersonName w:st="on">support@drupal.org</st1:PersonName>'; '<st1:PersonName w:st="on">Ms. Nancy Wichmann</st1:PersonName>'<br>
<b><span style="font-weight:bold">Subject:</span></b> Re: [support] Time Zones</span></font><o:p></o:p></p>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">Hmm… Well actually the strtotime function returns the current time in the “default” timezone by default. The default timezone is not
necessarily your php.ini file’s timezone as it can be overridden with a call to the php function date_timezone_set. Everyone have a headache yet?
<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:navy">The best way to determine which timezone is affected by strtotime() is to stick in a command like (assuming
you have the devel module enabled): dsm(</span></font><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:
"Courier New";color:black">date_default_timezone_get());
<o:p></o:p></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:navy">On my drupal installation this does not return GMT number. So what you want to do if you want GMT time is
to append “GMT” to the time. <o:p></o:p></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:black"><o:p> </o:p></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:black">Check out the following code snippet:
<o:p></o:p></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:black"> $output =
</span></font><font size="2" color="#0000c0" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:#0000C0">'<pre>'</span></font><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:black">;</span></font><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:black"> $output .= date_default_timezone_get() .
</span></font><font size="2" color="#0000c0" face="Courier New"><span style="font-size:10.0pt;
font-family:"Courier New";color:#0000C0">"\n"</span></font><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:
"Courier New";color:black">;</span></font><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:black"> $output .= strtotime(</span></font><font size="2" color="#0000c0" face="Courier New"><span style="font-size:10.0pt;font-family:
"Courier New";color:#0000C0">'January
1 1970 00:00:0'</span></font><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:
"Courier New";color:black">).
</span></font><font size="2" color="#0000c0" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:#0000C0">"\n"</span></font><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:black">;</span></font><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:black"> $output .= strtotime(</span></font><font size="2" color="#0000c0" face="Courier New"><span style="font-size:10.0pt;font-family:
"Courier New";color:#0000C0">'January
1 1970 GMT'</span></font><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:black">) .
</span></font><font size="2" color="#0000c0" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";color:#0000C0">"\n"</span></font><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:
"Courier New";color:black">;</span></font><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""><o:p> </o:p></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:black"> $output .=
</span></font><font size="2" color="#0000c0" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:#0000C0">'</pre>'</span></font><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:black">;<o:p></o:p></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:black"><o:p> </o:p></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:black">On my box this returns.
<o:p></o:p></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:black"><o:p> </o:p></span></font></p>
<pre style="mso-margin-top-alt:.25in;margin-right:0in;margin-bottom:.25in;
margin-left:0in;line-height:18.0pt"><font size="3" color="black" face="Courier New"><span style="font-size:12.0pt;color:black">America/Los_Angeles<br>
<br>
<o:p></o:p></span></font></pre>
<pre style="mso-margin-top-alt:.25in;margin-right:
0in;margin-bottom:.25in;margin-left:0in;line-height:18.0pt"><font size="3" color="black" face="Courier New"><span style="font-size:12.0pt;color:black">28800<br>
<br>
<o:p></o:p></span></font></pre>
<pre style="mso-margin-top-alt:.25in;margin-right:
0in;margin-bottom:.25in;margin-left:0in;line-height:18.0pt"><font size="3" color="black" face="Courier New"><span style="font-size:12.0pt;color:black">0<o:p></o:p></span></font></pre>
<p class="MsoNormal" style="text-autospace:none"><font size="2" color="black" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New";
color:black"><o:p> </o:p></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font size="2" face="Courier New"><span style="font-size:10.0pt;font-family:"Courier New""><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">Hope that helps.
<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">
<hr size="2" width="100%" align="center" tabindex="-1">
</span></font></div>
<p class="MsoNormal"><b><font size="2" face="Tahoma"><span style="font-size:10.0pt;
font-family:Tahoma;font-weight:bold">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size:10.0pt;font-family:Tahoma"> support-bounces@drupal.org [mailto:support-bounces@drupal.org]
<b><span style="font-weight:bold">On Behalf Of </span></b><st1:PersonName w:st="on">Ms. Nancy Wichmann</st1:PersonName><br>
<b><span style="font-weight:bold">Sent:</span></b> Thursday, February 28, 2013 7:55 AM<br>
<b><span style="font-weight:bold">To:</span></b> support drupal<br>
<b><span style="font-weight:bold">Subject:</span></b> [support] Time Zones</span></font><o:p></o:p></p>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt"><o:p> </o:p></span></font></p>
<div>
<div>
<p class="MsoNormal" style="background:white"><font size="3" color="black" face="Arial"><span style="font-size:12.0pt;font-family:Arial;color:black">Being blond, confusion is my normal state, but time zones are threatening to ruin what's left of my mental health.<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" color="black" face="Arial"><span style="font-size:
12.0pt;font-family:Arial;color:black"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" color="black" face="Arial"><span style="font-size:
12.0pt;font-family:Arial;color:black">In D7, we set the site's default time zone (America/New_York for me). Since it then displays the correct time, I have to assume that
the server is running on GMT. Is that correct?<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" color="black" face="Arial"><span style="font-size:
12.0pt;font-family:Arial;color:black"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" color="black" face="Arial"><span style="font-size:
12.0pt;font-family:Arial;color:black">If I read the PHP manual correctly, the strtotime() function will create a GMT time. Is that correct?
<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" color="black" face="Arial"><span style="font-size:
12.0pt;font-family:Arial;color:black"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" color="black" face="Arial"><span style="font-size:
12.0pt;font-family:Arial;color:black">So if I ask the user to tell me their timezone when they enter a time, I can stick that on the end of the string that I pass to strtotime()
and get a GMT timestamp?<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><font size="3" color="black" face="Arial"><span style="font-size:12.0pt;font-family:Arial;color:black"> <o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><st1:place w:st="on"><st1:City w:st="on"><b><i><font size="4" color="#ff007f" face="Bookman Old Style"><span style="font-size:13.5pt;font-family:"Bookman Old Style";color:#FF007F;
font-weight:bold;font-style:italic">Nancy</span></font></i></b></st1:City></st1:place><font color="black" face="Arial"><span style="font-family:Arial;color:black"><o:p></o:p></span></font></p>
</div>
<p class="MsoNormal" style="background:white"><font size="3" color="black" face="Arial"><span style="font-size:12.0pt;font-family:Arial;color:black"><o:p> </o:p></span></font></p>
</div>
</div>
</body>
</html>