<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'time()' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'time()' posted on the 'PHP' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 25 May 2013 02:56:39 -0700</pubDate>
    <lastBuildDate>Sat, 25 May 2013 02:56:39 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>time()</title>
      <link>http://www.programmersheaven.com/mb/phpstuff/260525/260525/time/</link>
      <description>is it possible that when i save data using time(),which the time was in pm and then when display, it is in am?is this error possible to happen because i didnt set it in according the time zone?&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/phpstuff/260525/260525/time/</guid>
      <pubDate>Wed, 26 May 2004 02:13:49 -0700</pubDate>
      <category>PHP</category>
    </item>
    <item>
      <title>Re: time()</title>
      <link>http://www.programmersheaven.com/mb/phpstuff/260525/261219/re-time/#261219</link>
      <description>: is it possible that when i save data using time(),which the time was in pm and then when display, it is in am?is this error possible to happen because i didnt set it in according the time zone?&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No, that is impossible :) Unless you are doing some buggy calculations on it there should be no discrempentcy AT ALL.&lt;br /&gt;
&lt;br /&gt;
The time() value comes STRAIGHT from your server. It has NOTHING to do with user's computers or the users themselves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A handy feature i use often is to allow users to choose their current timezone (or GMT offset) from a preferences page.&lt;br /&gt;
&lt;br /&gt;
When they login.. i put it in a cookie.. then on every page that needs it (forums make best use of this)&lt;br /&gt;
&lt;br /&gt;
So if you read the cookie.. and put that time offset into a variable called something like $timeoffset&lt;br /&gt;
$timeoffset = $HTTP_SESSION_VARS['somesessionname'];&lt;br /&gt;
or&lt;br /&gt;
$timeoffset = $HTTP_COOKIE_VARS['somecookiename'];&lt;br /&gt;
&lt;br /&gt;
You can do this for time:&lt;br /&gt;
&lt;br /&gt;
$q = mysql_query("SELECT timeofpost FROM posts_table WHERE  .. blah blah blah");&lt;br /&gt;
$data = mysql_fetch_row($q);&lt;br /&gt;
$time = $data[0];&lt;br /&gt;
&lt;br /&gt;
$newtime = $time + ($timeoffset * 86400);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So if the users time offset is -5 then time is -432000 seconds behind YOUR SERVER TIME (sometimes it is not GMT so you must check to see if it is)&lt;br /&gt;
&lt;br /&gt;
Then obviously to show the time:&lt;br /&gt;
$timestring = date("blah blah", $time);&lt;br /&gt;
echo $timestring;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* sorry i tend to go a little far on my explinations and just add things that aren't always necessary :P&lt;br /&gt;
&lt;strong&gt;&lt;span style="color: Blue;"&gt;Snoochie Boochies&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/phpstuff/260525/261219/re-time/#261219</guid>
      <pubDate>Mon, 31 May 2004 02:10:53 -0700</pubDate>
      <category>PHP</category>
    </item>
    <item>
      <title>Re: time()</title>
      <link>http://www.programmersheaven.com/mb/phpstuff/260525/261490/re-time/#261490</link>
      <description>ok..thanks&lt;br /&gt;
&lt;br /&gt;
: : is it possible that when i save data using time(),which the time was in pm and then when display, it is in am?is this error possible to happen because i didnt set it in according the time zone?&lt;br /&gt;
: : &lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: No, that is impossible :) Unless you are doing some buggy calculations on it there should be no discrempentcy AT ALL.&lt;br /&gt;
: &lt;br /&gt;
: The time() value comes STRAIGHT from your server. It has NOTHING to do with user's computers or the users themselves.&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: A handy feature i use often is to allow users to choose their current timezone (or GMT offset) from a preferences page.&lt;br /&gt;
: &lt;br /&gt;
: When they login.. i put it in a cookie.. then on every page that needs it (forums make best use of this)&lt;br /&gt;
: &lt;br /&gt;
: So if you read the cookie.. and put that time offset into a variable called something like $timeoffset&lt;br /&gt;
: $timeoffset = $HTTP_SESSION_VARS['somesessionname'];&lt;br /&gt;
: or&lt;br /&gt;
: $timeoffset = $HTTP_COOKIE_VARS['somecookiename'];&lt;br /&gt;
: &lt;br /&gt;
: You can do this for time:&lt;br /&gt;
: &lt;br /&gt;
: $q = mysql_query("SELECT timeofpost FROM posts_table WHERE  .. blah blah blah");&lt;br /&gt;
: $data = mysql_fetch_row($q);&lt;br /&gt;
: $time = $data[0];&lt;br /&gt;
: &lt;br /&gt;
: $newtime = $time + ($timeoffset * 86400);&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: So if the users time offset is -5 then time is -432000 seconds behind YOUR SERVER TIME (sometimes it is not GMT so you must check to see if it is)&lt;br /&gt;
: &lt;br /&gt;
: Then obviously to show the time:&lt;br /&gt;
: $timestring = date("blah blah", $time);&lt;br /&gt;
: echo $timestring;&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: * sorry i tend to go a little far on my explinations and just add things that aren't always necessary :P&lt;br /&gt;
: &lt;strong&gt;&lt;span style="color: Blue;"&gt;Snoochie Boochies&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/phpstuff/260525/261490/re-time/#261490</guid>
      <pubDate>Tue, 01 Jun 2004 19:18:03 -0700</pubDate>
      <category>PHP</category>
    </item>
    <item>
      <title>Re: time()</title>
      <link>http://www.programmersheaven.com/mb/phpstuff/260525/264710/re-time/#264710</link>
      <description>thansk anyway..i have solve my problem&lt;br /&gt;
&lt;br /&gt;
: : is it possible that when i save data using time(),which the time was in pm and then when display, it is in am?is this error possible to happen because i didnt set it in according the time zone?&lt;br /&gt;
: : &lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: No, that is impossible :) Unless you are doing some buggy calculations on it there should be no discrempentcy AT ALL.&lt;br /&gt;
: &lt;br /&gt;
: The time() value comes STRAIGHT from your server. It has NOTHING to do with user's computers or the users themselves.&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: A handy feature i use often is to allow users to choose their current timezone (or GMT offset) from a preferences page.&lt;br /&gt;
: &lt;br /&gt;
: When they login.. i put it in a cookie.. then on every page that needs it (forums make best use of this)&lt;br /&gt;
: &lt;br /&gt;
: So if you read the cookie.. and put that time offset into a variable called something like $timeoffset&lt;br /&gt;
: $timeoffset = $HTTP_SESSION_VARS['somesessionname'];&lt;br /&gt;
: or&lt;br /&gt;
: $timeoffset = $HTTP_COOKIE_VARS['somecookiename'];&lt;br /&gt;
: &lt;br /&gt;
: You can do this for time:&lt;br /&gt;
: &lt;br /&gt;
: $q = mysql_query("SELECT timeofpost FROM posts_table WHERE  .. blah blah blah");&lt;br /&gt;
: $data = mysql_fetch_row($q);&lt;br /&gt;
: $time = $data[0];&lt;br /&gt;
: &lt;br /&gt;
: $newtime = $time + ($timeoffset * 86400);&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: So if the users time offset is -5 then time is -432000 seconds behind YOUR SERVER TIME (sometimes it is not GMT so you must check to see if it is)&lt;br /&gt;
: &lt;br /&gt;
: Then obviously to show the time:&lt;br /&gt;
: $timestring = date("blah blah", $time);&lt;br /&gt;
: echo $timestring;&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: * sorry i tend to go a little far on my explinations and just add things that aren't always necessary :P&lt;br /&gt;
: &lt;strong&gt;&lt;span style="color: Blue;"&gt;Snoochie Boochies&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/phpstuff/260525/264710/re-time/#264710</guid>
      <pubDate>Sun, 27 Jun 2004 18:31:49 -0700</pubDate>
      <category>PHP</category>
    </item>
  </channel>
</rss>