How do you find out the date of next Monday on Thursday, August 29?
I was thinking about it, of course, I could calculate by myself. However, as usual, I was lazy and my brain didn’t even want to solve for the answer of one plus one. So, I didn’t bother clicking on calendar to view it or simply run cal 9 2013.
Instead, I ran:
~ $ date -d 'next monday'
Mon Sep 2 00:00:00 CST 2013
Moving mouse cursor, nah, too much work for me. I rather typed in a command since my hands were on keyboard and focus was in terminal window. Reading cal output, nah, locating next Monday is too much work, although it’s at first row.
I could be even lazier:
~ $ date -d monday
Mon Sep 2 00:00:00 CST 2013
~ $ date -d mon
Mon Sep 2 00:00:00 CST 2013
This is first time I typed in such date string for a result I actually wanted to know, and it’s quite a pretty good usage example in real life. However, I have used date parsing in sleeptil, a Bash function which I did use a few times.
Counting down to next Monday Morning Syndrome to happen? You bet I can. I have coded urtimer as a countdown timer, which I recently added -d, but it wasn’t by intention and I hadn’t known I would be somehow wanted to know “next monday.”
~ $ sleeptil -v 'next monday 6am'
Mon Sep 2 06:00:00 CST 2013 in 3 days 7 hour 23 minutes 26 seconds
~ $ urtimer -d 'next monday 8am'
Screen shows about 81 hours, like this
▄▀▀▀▄ ▄█ ▄█ ▄▀▀▀▄ █▀▀▀▀ ▀▀▀▀█ ▄▀▀▀▄
█ █ █ ▀ █ █ █ ▀ █ ▐▌ █ █
▄▀▀▀▄ █ ▄ █ ▀▀▀█ ▄ ▀▀▀▀▄ █ █ █
█ █ █ █ █ █ ▐▌ █ █
▀▀▀ ▀▀▀ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀ ▀ ▀▀▀
The truth is I wasn’t lazy nor my brain didn’t want to give me an answer, somehow, I was looking for something different or unique. I could just move my hand to control the mouse, but I didn’t. My brain was actually knowing next Monday would be in September. Simple counting, I would know the answer, but I didn’t do it.
For some reason, I have developed a set of simple tools—which seemingly are related to one another—without even knowing I was doing that. Time certainly connects things we least expect, even people if you will, like one who is currently reading.
Anyway, the best one still is:
date -d 'next monday'
I love how you can tell date what you want with these two words.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.