Jump to content

Compare int TIMESTAMP.


SamohtVII

Recommended Posts

I was wondering how timestamps are written to integers and how I can extract the date from it so I can compare it with a date of my own. Basically I have a INT field in my database and it gets a timestamp put into it. How can I compare that timestamp to say a week later.So I have the timestamp 1365409603 which somehow equals the 8th of april 2013. How can I add seven days to this number and store that ina variable then say (if timestamp is 7 seven days away from variableTime) etc. Hope it wasn't too confusing.Thanks

Link to comment
Share on other sites

The timestamp is the number of seconds since 1/1/1970. So increasing the time is just a matter of adding more seconds. There are 86400 seconds in one day (60 seconds * 60 minutes * 24 hours), so you can add (86400 * 7) to increase the date by a week.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...