Why can't there be a single me…

Why can't there be a single method of tracking time? No, I don't mean the number seconds since 1970. What the hell were they smoking?

Write a Comment

Comment

  1. Yes, all of my time!

    The unix timestamp (number of seconds that have passed since Jan 1st, 1970) is in GMT, so if you need to convert it to your local time, you need to subtract the number of seconds your local time differs from GMT (-05:00 hours for EST, so thats 14400 seconds).

    In PHP the time() function, and I quote, “Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)”.

    So you’d expect that I would need to subtract my 14400 seconds from whatever time() outputs, correct? WRONG! The time() function already subtracts the 14400 seconds from the Unix timestamp before outputting it. I wonder why that’s not mentioned anywhere on the PHP documentation page.