Announcement

Collapse
No announcement yet.

Calculating number of seconds since a specific date & time (Military)...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calculating number of seconds since a specific date & time (Military)...

    I'm scratching my head on how to calculate the number of seconds since a specific date/time. The problem isn't the math, rather the records. For instance, it's easy to say 60 seconds in a minute, 60 minutes in an hour and 24 hours in a day. But how many days in the last month? 29? 30? 31? Was it a leap year 3 years ago?

    Anyone know of an easy way to grab this? Ideally, I'm looking for a formula. I have the "average" seconds in a year based on 365.2425 days per year average but not the actual numbers. I'm still working on the problem, but suggestions are awesome.

    Thanks! =)
    "White-colla-AMS-gangsta."

  • #2
    You could use os.time() to get the timestamp of the dates, and then substract one value from the other. The result is the number of seconds between the dates, which you can convert back to days, etc.

    Ulrich

    Comment


    • #3
      Interesting. I wonder if it calculates things like Leap Years? I'm going to have to play with it some. Thanks for the reply Ulrich!
      "White-colla-AMS-gangsta."

      Comment

      Working...
      X