difference between two date in seconds: problem with daylight saving time

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • _mario.lat

    difference between two date in seconds: problem with daylight saving time

    Hallo,
    I have to calculate difference in seconds between two timestamp (unixtime).
    the problem is when there is daylight saving time so in this case
    end-start shoultd be negative and wrong data.
    How can I do?
    there is a function that lead this problem?
    Thank you in advance,
    Mario.
  • Curtis

    #2
    Re: difference between two date in seconds: problem with daylightsaving time

    _mario.lat wrote:
    Hallo,
    I have to calculate difference in seconds between two timestamp (unixtime).
    the problem is when there is daylight saving time so in this case
    end-start shoultd be negative and wrong data.
    How can I do?
    there is a function that lead this problem?
    Thank you in advance,
    Mario.
    Check out the manual: http://php.net/date - Look at the format
    character, 'Z', which is your server's difference in time from GMT.
    From there, you can handle DST or force the time to a specific offset.

    Comment

    • J.O. Aho

      #3
      Re: difference between two date in seconds: problem with daylightsaving time

      _mario.lat wrote:
      Hallo,
      I have to calculate difference in seconds between two timestamp (unixtime).
      the problem is when there is daylight saving time so in this case
      end-start shoultd be negative and wrong data.
      How can I do?
      there is a function that lead this problem?
      Store time in UTC, and when you display times for the user to read, convert
      the UTC time to the time that is currently used in your location, this way you
      won't get troubles with CET/CETS.


      --

      //Aho

      Comment

      Working...