Fun Alongside Engagement Arithmetic

We all know that the date ascendency tells yous the electrical flow time. Occasionally, yous operate the same ascendency to gear upward the time. That yet becomes rarer these days alongside the advent of the ntp service that automatically synchronizes your computer's fourth dimension alongside a super accurate populace fourth dimension server of your choice.

Various implementations of the date ascendency are inwards operate today. This article discusses the date ascendency of the GNU coreutils package.

By default, the date ascendency tells yous the fourth dimension now. The date ascendency also lets yous produce about basic appointment add-on in addition to subtraction. This is achieved past times specifying the -d alternative which displays a fourth dimension that yous entered equally a parameter rather than now.

How many times convey yous asked yourself what the calendar appointment is northward days ago? Just the other day, I needed to discovery out the precise appointment of xxx days agone inwards social club to locate the proper log file.

$ date
Sat November fourteen 17:54:51 PST 2009
$ appointment -d -30days
Thu October fifteen 18:54:56 PDT 2009


Just similar yous operate subtraction to calculate a dorsum date, yous operate add-on to calculate a frontwards date. The event below displays the appointment xxx days from today.
$ appointment -d +30days
Thu October fifteen 18:54:56 PDT 2009


Besides days equally the unit, yous tin also manipulate years, months, hours, minutes, in addition to seconds.
peter@tiger: $ appointment -d +2months
Thu Jan fourteen 18:48:43 PST 2010


You tin combine them together similar this:
$ appointment -d +2months17days
Sun Jan 31 18:49:45 PST 2010


Note that all the higher upward are calculated relative to today's date. What almost queries similar x days tomorrow?
$ appointment -d tomorrow+10days
date -d tomorrow+10days
Wed November 25 18:52:03 PST 2009


10 days yesterday?
$ appointment -d yesterday-10days
Tue November three 18:53:07 PST 2009


You tin also perform your arithmetics relative to a specific day, nation Jan 21, 2010.
$ appointment -d '2010-01-21 + ii weeks three days'
Sun February seven 00:00:00 PST 2010


Lastly, the date ascendency also recognizes the 24-hour interval of weeks (Sunday, Monday, ...) in addition to the ii keywords "last" in addition to "next".
$ appointment -d 'next tuesday + 1 day'
Wed November xviii 00:00:00 PST 2009


I promise yous convey fun alongside this versatile tool.

Berlangganan update artikel terbaru via email:

0 Response to "Fun Alongside Engagement Arithmetic"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel