cm0002@lemmy.world to Programmer Humor@programming.dev · 3 天前I'm new to using Ruby and this tickled me pinklemmy.mlimagemessage-square72fedilinkarrow-up1462arrow-down15cross-posted to: programmerhumor@lemmy.ml
arrow-up1457arrow-down1imageI'm new to using Ruby and this tickled me pinklemmy.mlcm0002@lemmy.world to Programmer Humor@programming.dev · 3 天前message-square72fedilinkcross-posted to: programmerhumor@lemmy.ml
minus-squarertxn@lemmy.worldlinkfedilinkarrow-up25arrow-down1·3 天前timedelta marks time in days, seconds, and microseconds. It doesn’t take leap years into account because the concept of years is irrelevant to timedelta. If you need to account for leap years, you need a different API.
minus-squarenilloc@discuss.tchncs.delinkfedilinkEnglisharrow-up1·1 天前365.25*10 would at least get you closer.
minus-squareRandelung@lemmy.worldlinkfedilinkarrow-up1·2 天前You can subtract two dates and get the exact time difference.
timedelta
marks time in days, seconds, and microseconds. It doesn’t take leap years into account because the concept of years is irrelevant totimedelta
. If you need to account for leap years, you need a different API.365.25*10 would at least get you closer.
You can subtract two dates and get the exact time difference.