cm0002@lemmy.world to Programmer Humor@programming.dev · 1 年前I'm new to using Ruby and this tickled me pinklemmy.mlimagemessage-square72fedilinkarrow-up1469arrow-down15cross-posted to: programmerhumor@lemmy.ml
arrow-up1464arrow-down1imageI'm new to using Ruby and this tickled me pinklemmy.mlcm0002@lemmy.world to Programmer Humor@programming.dev · 1 年前message-square72fedilinkcross-posted to: programmerhumor@lemmy.ml
minus-squareErr(()).unwrap()@lemmy.worldlinkfedilinkarrow-up27arrow-down1·1 年前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-up2·11 个月前365.25*10 would at least get you closer.
minus-squareRandelung@lemmy.worldlinkfedilinkarrow-up1·11 个月前You can subtract two dates and get the exact time difference.
timedeltamarks 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.