sunshine@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 12 hours agoI'm new to using Ruby and this tickled me pinkimagemessage-square52fedilinkarrow-up1156arrow-down14
arrow-up1152arrow-down1imageI'm new to using Ruby and this tickled me pinksunshine@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 12 hours agomessage-square52fedilink
minus-squareEager Eagle@lemmy.worldlinkfedilinkEnglisharrow-up8arrow-down2·9 hours agoI prefer the one on the left because it’s evident it doesn’t account for leap days, while I’d be questioning whether the one on the right does.
minus-squareDiplomjodler@lemmy.worldlinkfedilinkarrow-up2·edit-23 hours agoI’ll give it a shot. Looks a bit kludgy and I’ve been typing this on my phone while sitting on the toilet. What am I doing with my life? from datetime import datetime now = datetime.now() year = now.strftime('%Y') month = now.strftime('%m') day = now.strftime('%d') tenyearsago = datetime(year-10, month, day) print(tenyearsago.strftime('%d.%m.%Y')
minus-squareDigital Mark@lemmy.sdf.orglinkfedilinkEnglisharrow-up1·57 minutes agoAnd what happens when you run that on Feb 29, 2024?
I prefer the one on the left because it’s evident it doesn’t account for leap days, while I’d be questioning whether the one on the right does.
I’ll give it a shot. Looks a bit kludgy and I’ve been typing this on my phone while sitting on the toilet. What am I doing with my life?
And what happens when you run that on Feb 29, 2024?