06-27-2013
Quote:
Originally Posted by
mohanalakshmi
Hi guys thanks for the help for my previous posts.Now i have a requirement that i download a XMl file which has UTC time stamp.I need to convert UTC time into Unix server timezone.
For ex if the time zone of unix server is CDT then i need to convert into CDT.whatever may be the system time zone i need to convert to that time zone(Not to the curent time only to the server time zone).Because my prog may run on different timezone servers.
Please help me guys.Thanks for the forum.
Saying that you have a UTC time stamp is ambiguous; please show us the format of the time stamps you have and the format of the time stamps you want to produce. What are you going to do with the timestamps in your XML input files?
Is there a /usr/gnu/bin/date or a /usr/bin/gdate installed on your Solaris system?
This User Gave Thanks to Don Cragun For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a list of interfaces and time the interface was last active. I can't figure out how to convert the time in the second column,
Fa1/14 0
Se0/0/0 0
Fa1/11 0
Fa1/9 0
Fa1/0 0
Se0/0/1 1240401408
Gi1/0 0
Fa0/0 1240401408
Fa1/3 0
Fa1/8 0
Fa1/15 0
Fa1/13 0
Fa1/10 0
Fa1/1 0
Fa1/12... (7 Replies)
Discussion started by: mrlayance
7 Replies
2. Shell Programming and Scripting
Hi,
I need to convert a number representing time in UTC seconds to a date. Ex:
3BE0082C --> Oct 31 2001 15:31:08
I have tried the following perl command but it gives a different answer?
$ perl -e 'print scalar localtime(shift), "\n"' 3BE00B2C
Thu Jan 1 03:00:03 1970
Any ideas? Thanks. :) (10 Replies)
Discussion started by: GNMIKE
10 Replies
3. AIX
Hello,
Using AIX6.1 box.
I have UTC time value and need to convert it to local time value - I mean time zone and DST should be taken into consideration.
I hope it could be done using shell environment - I don't want to write a program.
thanks
Vilius
---------- Post updated at 02:30 PM... (2 Replies)
Discussion started by: vilius
2 Replies
4. Shell Programming and Scripting
Hello All -
I have a script that grabs data from the net and outputs the following data
46029 46.144 -124.510 2010 07 26 22 50 320 4.0 6.0 2.2 9 6.8 311 1012.1 -0.9 13.3 13.5 13.3 - -
46041 47.353 -124.731 2010 07 26 22 50 250 2.0 3.0 1.6 8 6.4 - 1011.6 - ... (0 Replies)
Discussion started by: drexnefex
0 Replies
5. AIX
Okay, so let's say we have a string like:
20110105_193345
This represents:
January 5th, 2011 = 20110105
24-hour style time 19:33:45 = 193345
Okay, so we have our time. It's January 5th, 2011 at 19:33:45. I want to convert this time from Eastern Time Zone (which it currently is in)... (1 Reply)
Discussion started by: syndex
1 Replies
6. UNIX for Dummies Questions & Answers
Hi,
A few days ago I changed my CentOS box's timezone to -07:00.
Now the date commands output look like this (run almost simultaneously, less than 1 second delay)..
# date
Mon Sep 5 20:23:40 PDT 2011
# date -u
Tue Sep 6 03:24:05 UTC 2011
The hours difference seems correct, but why is... (2 Replies)
Discussion started by: forte712
2 Replies
7. Solaris
I have a cluster of two Solaris server (veritas cluster). one working and the other is standby
I am going to change the date on them , and am looking for a secure solution as it is giving an important service.
my opinion is that the active one doesn't need to be restarted (if I don't change the... (1 Reply)
Discussion started by: barry1946
1 Replies
8. Shell Programming and Scripting
Hi Folks,
My server time is in EDT. And i am sending automated mails from that server in which i need to display the current date time as per IST (GMT+5:30). Please advice how to display the date time as per IST.
IST time leads 9:30 mins to EDT. and i wrote something like below.
... (6 Replies)
Discussion started by: Showdown
6 Replies
9. AIX
Hello AIX friends,
We have timezone settings on our AIX 6.1 boxes set to Europe/London.
How can I change it to UTC timezone with Daylight saving disabled.
After running "smit chtz_user" I don't see UTC option in the listing.
Please advise.
TIA (3 Replies)
Discussion started by: prvnrk
3 Replies
10. UNIX for Dummies Questions & Answers
hi,
my system date and time zone is PDT. whenever i append date time stamp to a file it appends the system date thats PDT date time zone. i want to append GMT time zone. is there a mechanism or option which can append the date time stamp according to GMT. (4 Replies)
Discussion started by: Little
4 Replies
LEARN ABOUT FREEBSD
adjkerntz
ADJKERNTZ(8) BSD System Manager's Manual ADJKERNTZ(8)
NAME
adjkerntz -- adjust the local time CMOS clock to reflect time zone changes and keep the current timezone offset for the kernel
SYNOPSIS
adjkerntz -i
adjkerntz -a [-s]
DESCRIPTION
The adjkerntz utility maintains the proper relationship between the kernel clock, which is always set to UTC and the CMOS clock, which may be
set to local time. The adjkerntz utility also informs the kernel about machine timezone shifts in order to maintain proper timestamps for
local time file systems such as the MS-DOS file system. The main purpose of maintaining these timestamps properly is to keep the timestamps
of a FreeBSD MS-DOS file system and an MS-DOS operating system synchronized when they are installed on the same system rather than fixing
broken MS-DOS file timestamps. If the file /etc/wall_cmos_clock exists, it means that the CMOS clock keeps local time (MS-DOS and MS-Windows
compatible mode). If that file does not exist, it means that the CMOS clock keeps UTC time. The adjkerntz utility passes this state to the
machdep.wall_cmos_clock kernel variable.
Adjustments may be needed at system startup and shutdown, and whenever a time zone change occurs. To handle these different situations,
adjkerntz is invoked in two ways:
-i This form handles system startups and shutdowns. The adjkerntz utility is invoked with this option from /etc/rc on entry to multi-user
mode, before any other daemons have been started. The adjkerntz utility puts itself into the background. Then, for a local time CMOS
clock, adjkerntz reads the local time from it and sets the kernel clock to the corresponding UTC time. The adjkerntz utility also
stores the local time zone offset in the machdep.adjkerntz kernel variable, for use by subsequent invocations of 'adjkerntz -a' and by
local time file systems.
For a local time CMOS clock 'adjkerntz -i' pauses and remains inactive as a background daemon until it receives a SIGTERM. The SIGTERM
will normally be sent by init(8) when the system leaves multi-user mode (usually, because the system is being shut down). After
receiving the SIGTERM, adjkerntz reads the UTC kernel clock and updates the CMOS clock, if necessary, to ensure that it reflects the
current local time zone. Then adjkerntz exits.
-a [-s]
This form is used to update the local time CMOS clock and kernel machdep.adjkerntz variable when time zone changes occur, e.g., when
entering or leaving daylight savings time. The adjkerntz utility uses the kernel clock's UTC time, the previously stored time zone
offset, and the changed time zone rule to calculate a new time zone offset. It stores the new offset into the machdep.adjkerntz kernel
variable and updates the wall CMOS clock to the new local time. If 'adjkerntz -a' was started at a nonexistent time (during a timezone
change), it exits with a warning diagnostic unless the -s option was used, in which case adjkerntz sleeps 30 minutes and tries again.
This form should be invoked from root's crontab(5) every half hour between midnight and 5am, when most modern time zone changes occur.
Warning: do not use the -s option in a crontab(5) command line, or multiple 'adjkerntz -a' instances could conflict with each other.
The adjkerntz utility clears the kernel timezone structure and makes the kernel clock run in the UTC time zone. Super-user privileges are
required for all operations.
ENVIRONMENT
TZ Time zone change rule, see tzset(3); not needed when tzsetup(8) or zic(8) is used.
FILES
/etc/localtime Current zoneinfo file, see tzsetup(8) and zic(8).
/etc/wall_cmos_clock Empty file. Its presence indicates that the machine's CMOS clock is set to local time, while its absence indicates a
UTC CMOS clock.
DIAGNOSTICS
No diagnostics. If an error occurs, adjkerntz logs an error message via syslog(3) and exits with a nonzero return code.
SEE ALSO
tzset(3), crontab(5), mount_msdosfs(8), rc(8), sysctl(8), tzsetup(8), zic(8)
HISTORY
The adjkerntz utility appeared in FreeBSD 1.0.
AUTHORS
Andrey A. Chernov <ache@astral.msk.su>
BSD
March 8, 2012 BSD