# How do you account for months when converting to epoch time?

Member, PRO Posts: 73

I would assume the formula for converting to epoch time would be:

(game.year-2016)(Seconds in a year)+(game.month-1)(HOW MANY SECONDS IN A MONTH???)+(game.day-1)(Seconds in a day)+(game.hour)(seconds in a hour)+(game.minutes)*(60)+game.seconds.

The problem being I have no idea how many seconds are in a month because it varies from month to month..

• Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,937

This site has a specific value for the number of seconds in a month: http://www.epochconverter.com. You might just use that...?

New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

• Member, PRO Posts: 73

but that number is an average. It would mess up my time right? like February 1st it would count january as 30.5 days(the average) but really its 31 days so half a day would be shaved off my epoch time.

• Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,937

I suppose that's true. I'm sure someone else has had to tackle this question so hopefully you get some advice here!

New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

• Member, PRO Posts: 73

Yeah I sure hope so, but I appreciate the effort pal!

• Member, Sous Chef, PRO Posts: 2,864
edited January 2016

Here is a thread from about 6 months ago that might be of interest.