Monday, February 18, 2008

GNU date

I didn't know that you can use date strings with this tool

kiru@kiru-laptop:~$ date
Mon Feb 18 07:25:16 PST 2008
kiru@kiru-laptop:~$ date --date "ten years ago"
date: invalid date `ten years ago'
kiru@kiru-laptop:~$ man date
kiru@kiru-laptop:~$ date --date="ten years ago"
date: invalid date `ten years ago'
kiru@kiru-laptop:~$ date --date="10 years ago"
Wed Feb 18 07:25:57 PST 1998
kiru@kiru-laptop:~$ date --date="10 years and 12 days ago"
date: invalid date `10 years and 12 days ago'
kiru@kiru-laptop:~$ date --date="10 years 12 days ago"
Tue Feb 6 07:26:28 PST 2018

[more info]

Human friendly date strings are awesome. It would be a nice feature to have in my webapps. I need to wrap this GNU tool in Python/Javascript code. I wonder if there is one already.

No comments: