cm0002@lemmy.world to Programmer Humor@programming.dev · 1 month agoI'm new to using Ruby and this tickled me pinklemmy.mlimagemessage-square72linkfedilinkarrow-up1466arrow-down15
arrow-up1461arrow-down1imageI'm new to using Ruby and this tickled me pinklemmy.mlcm0002@lemmy.world to Programmer Humor@programming.dev · 1 month agomessage-square72linkfedilink
minus-squarertxn@lemmy.worldlinkfedilinkarrow-up27arrow-down1·1 month agotimedelta 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·1 month ago365.25*10 would at least get you closer.
minus-squareRandelung@lemmy.worldlinkfedilinkarrow-up1·1 month agoYou 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.