Raam Dev » thoughts essays journal notes contact about subscribe rss

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?

  1. They were smoking time… your time. :?

  2. 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.

Leave a Reply

Subscribe without commenting.

Other posts you may enjoy:

Where in the world is Raam?

Join the Facebook Community

Raam Dev » thoughts essays journal notes contact about subscribe rss

Powered by WordPress and other Open Source Software
Uncopyright by Raam Dev