Logesh
Logesh

Reputation: 11

Adding 3 years to a timestamp

I have a timestamp that is fetched from the database. Now I have to add 3 years to it.

  1. Is it possible to add 3 years in timestamp itself and then converting the date and time format ?
  2. or after converting into the date and time format we can add?

How to add 3 years with respect to leap year and all those?

Upvotes: 1

Views: 966

Answers (1)

glglgl
glglgl

Reputation: 91109

For every non-leap year, add 365 * 86400 = 31536000.

For every leap year, add 366 * 86400 = 31622400.

Upvotes: 2

Related Questions