[Techtalk] Simple date question

mgmonza at sdf.lonestar.org mgmonza at sdf.lonestar.org
Mon Oct 7 07:35:14 UTC 2013


Hi, all,

This has been a typical linux time sponge for me.  I've been trying for 
far too many hours, reading man pages, duckduckgo'ing, etc, to simply set 
the time zone using the date command.

Does anyone know that this CAN'T be done?  It would save me much time to 
know this too, but that most inscrutable of man pages seems to say it can.

>From the DATE man page:
  %Z     alphabetic time zone abbreviation (e.g., EDT)
  %z     +hhmm numeric timezone (e.g., -0400)

This was typical of the hundreds of trys I've done, and it did't work:

sudo date -s +%Z --EDT

All I'm interested is setting this via the command line, either with date 
or some other one-liner that can be put into my .bashrc. My main laptop 
died a month ago and all I've got now is my old XP laptop filled to the 
max with work stuff I'll need if I ever find a computer job again. 
There's no room for even the barest of Linuxes, so I've been using a live 
Ubuntu CD and copying over the minimum necessary to just use it as a linux 
box. Most of my aliases take care of making a storage unit look like my 
lost home, but time thing got me.

This is my time alias, necessary because the disk sets the wrong time:

alias settime="sudo date '+%l:%M %p' -s \$1"

and works like this:

settime 3:41am

I'd just like that last tweak that sets it to EDT.

Thanks!

MG


More information about the Techtalk mailing list