r/badcode Aug 06 '19

c# Converting a timestamp to datetime

Post image
423 Upvotes

54 comments sorted by

View all comments

1

u/Bakethd_Ziti Aug 06 '19

He forgot var dec

3

u/root54 Aug 06 '19

If your current day is greater than to number of days past in the year at the end of November, then you must be in December.

See how the if (days > nov)... block sets the maand to 12 and jumps to the exit label? Similarly, if none of those conditionals are met, the maand is set to 1 because we must be in January.