Can I get "last monday based on 10 minutes ago" by linux date command ?
For example
- current time: 2016-02-09 00:05:00
- expected result: 2016-02-01 00:00:00
datelinux
Can I get "last monday based on 10 minutes ago" by linux date command ?
For example
Best Answer
If you have
faketime
and yourdate
is dynamically linked:With
ksh93
(only builtin commands):Here, if it was last Sunday instead of last Monday, you could do:
Or if it was last Saturday:
But for last Monday or any other day of the week, it involves a bit of arithmetic:
Otherwise, you can always do:
;-)