kxyoke / cs2102-fdsApp

0 stars 4 forks source link

Convert timestamp (real date) to FDS-DayMonth #39

Closed kxyoke closed 4 years ago

kxyoke commented 4 years ago

Supposing A is the first day of FDS Calendar (eg. 1/1/20 is FDS M1W1D1)

Since we store timestamp B in database, we want to compute FDS Day d. b = Days between A and B.

FDS W' = b / 7. FDS M = W' / 4.

FDS W = W' % 4. FDS D = ...sim.

Given: FDS 1W = 7D, 1M = 4W Goal: Stats computation + Delivery rider scheduling must be in FDS

kxyoke commented 4 years ago

Rough solutions: get difference in seconds, assume each day has __ seconds (no leap seconds etc) ref: https://stackoverflow.com/questions/542938/how-do-i-get-the-number-of-days-between-two-dates-in-javascript https://www.geeksforgeeks.org/how-to-calculate-the-number-of-days-between-two-dates-in-javascript/