Currently whenever i run date command output is shown like
Mon Apr 12 05:17:21 IST 2010
When its 17:17 Here.
How would i change it so that it should show.
Mon Apr 12 17:17:21 IST 2010
Currently whenever i run date command output is shown like
Mon Apr 12 05:17:21 IST 2010
When its 17:17 Here.
How would i change it so that it should show.
Mon Apr 12 17:17:21 IST 2010
The options of the date command vary from OS to OS. This should work as the root user on most systems:
date [-u] [MMDDhhmm[[CC]YY][.ss]]
-u denotes the time you enter is in GMT or UTC timezone, which may not be the timezone you are actually using.
So, try:
date 04121717
assuming you don't want to change seconds.
This is determined by your locale. See:
man 1 locale
What do you get for:
echo $TZ ; date ; date -u
touch /tmp/my_temp_filename
ls -lad /tmp/my_temp_filename
rm /tmp/my_temp_filename
output
echo $TZ
Nothing get displayed
date
Tue Apr 13 09:42:00 IST 2010
date -u
Tue Apr 13 04:11:13 UTC 2010
I am amazed that the difference between "date" and "date -u" is not a whole number of hours.
What Operating System do you have?
What Shell are you using?
Are you working in the same timezone as the computer? If not, what timezone?
Are you running a virtual machine or some other weird setup?
My first impression is that the system clock is 12 hours out but we really need to see what timestamp is going on new files.
IST is: India Standard Time (IST) +5.5 hours
so not that unusual. There's 3 seperate timezone that are 30 mins offsets, and at least one thats 45 min offsets
Thanks denn. It makes sense now. Not my part of the world.
Also the commands were not typed as one line but with a few seconds gap.
Once we find out the Operating System we can understand why the TZ environment variable is not set. It is pretty universal across unix O/S and even M$ O/S.
In general, even where the TZ environment variable is not set (as in several flavors of Linux based distributions) the utilities respond once if it is found in the environment when they run.
You can set it to the most useful value in /etc/profile, your crontab file, or anywhere else that makes sense.