cm0002@lemmy.world to Programmer Humor@programming.dev · 3 days agoI'm new to using Ruby and this tickled me pinklemmy.mlimagemessage-square72linkfedilinkarrow-up1462arrow-down15
arrow-up1457arrow-down1imageI'm new to using Ruby and this tickled me pinklemmy.mlcm0002@lemmy.world to Programmer Humor@programming.dev · 3 days agomessage-square72linkfedilink
minus-squarertxn@lemmy.worldlinkfedilinkarrow-up25arrow-down1·2 days 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-up1·23 hours ago365.25*10 would at least get you closer.
minus-squareRandelung@lemmy.worldlinkfedilinkarrow-up1·1 day 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.