Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I starting thinking about the Python equivalent of this and it was disgusting.


This?

  $ python -c 'import datetime; print(datetime.date(2019, 3, 12) + datetime.timedelta(days=366))'
  2020-03-12


Beautiful.


Yes.


Raku is a lot prettier than Python:

    perl6 -e 'say Date.new("2019-03-12").later( :366days )'
    2020-03-12
    perl6 -e 'say Date.new("2019-03-12") + 366'
    2020-03-12


Which recently became even shorter:

    raku -e 'say "2019-03-12".Date + 366'
    2020-03-12


Probably because I have a finance background, I would go straight to Excel.


Which makes dates out of things that are not even dates! (Like gene names)


Ruby isn't much better

    ruby -e "require 'date'; puts (Date.parse('march 12 2019') + 366)"
    2020-03-12




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: