mktime and negative timestamps (on linux, not windows).

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

    mktime and negative timestamps (on linux, not windows).

    From the manual, it seems negative timestamps should work on Linux, just
    not Windows.

    But anything I try before 1970, (i.e. a negative timestamp) is giving me
    12/31/1969.

    Is this right?

    --
    [ Sugapablo ]
    [ http://www.sugapablo.net <--personal | http://www.sugapablo.com <--music ]
    [ http://www.2ra.org <--political | http://www.subuse.net <--discuss ]

  • Peter van Schie

    #2
    Re: mktime and negative timestamps (on linux, not windows).

    Sugapablo wrote:[color=blue]
    > From the manual, it seems negative timestamps should work on Linux, just
    > not Windows.
    >
    > But anything I try before 1970, (i.e. a negative timestamp) is giving me
    > 12/31/1969.
    >
    > Is this right?
    >[/color]

    Yes mktime doesn't support dates before 1970 and after 2037.
    If you really need it, you could use an extension like:


    --

    Comment

    • Carl

      #3
      Re: mktime and negative timestamps (on linux, not windows).

      Sugapablo wrote:[color=blue]
      > From the manual, it seems negative timestamps should work on Linux, just
      > not Windows.
      >
      > But anything I try before 1970, (i.e. a negative timestamp) is giving me
      > 12/31/1969.
      >
      > Is this right?
      >[/color]

      How exactly are you setting the timestamp value?

      The following works fine for me (FreeBSD):

      $timeStamp = mktime(0, 0, 1, 1, 1, 1965);
      echo date("l dS of F Y h:i:s A", $timeStamp);

      prints "Friday 01st of January 1965 12:00:01 AM"

      Comment

      Working...