Date & time

Thorny thorntreehome at gmail.com
Sun May 3 15:24:23 UTC 2009


On Sun, 03 May 2009 04:31:14 -0600, Allen Meyers posted:

> The following appeared this AM as a means of setting time and date and I
> was wondering if someone on the list might translate for those of us who
> have difficulty with understanding a line like date +%Y%m%d -s
> "20090502" or date +%T -s "11:14:00". Quite simply how to set date and
> time so a challenged Texan can understand. Plus it might bring comic
> relief to the French troublemaker thread and give Karl time to reflect..
> 
> <!--break-->
> 
> date +%Y%m%d -s "20090502"
> 
> To set the time in Linux, enter
> 
> date +%T -s "11:14:00"
> 
> There are simple ways to set the date and time, here is one.
> 
> date -s "2 MAY 2009 11:14:00"
> 
> or
> 
> date 05021118
> 
> The format is
> 
> date MMDDhhmm
> 
> Allen Meyers
> texas.chef94 at gmail.com

Allen,
I don't have much time today and I came later than usual but I did notice
your email and I don't understand why no one has answered you yet, I'm
sure I'm not the only one around here that has an answer.

The string values are defined in the manual page for the date command
and/or online from a search engine with "strftime" and "format" as
keywords. No sense in reproducing those definitions here in the text of
this email. You could also get them in the manual page for strftime.

To give an example: date -s +%T "11:14:00"

The command is "date".
The option is "-s" (which stands for "set"). The format is "+%T" (%T
stands for the time in 24-hour notation (%H:%M:%S))

Thus the command would set the time to 11:14:00 am.





More information about the ubuntu-users mailing list