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.
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 does seem to be a bit vague. Here is a useful tip and in this case I am using the korn shell. The idea here is to temporarily define the TZ environment variable; that is....
TZ=CDT date
would define the TZ var for the execution of the date command...regardless of what the default TZ setting is.
By example...
[josephgr@oc0887178221 ~]$ date; TZ=UTC date
Wed Dec 11 17:57:03 CST 2013
Wed Dec 11 23:57:03 UTC 2013
This isn't a ksh feature, it is standard behavior required for any shell conforming to the POSIX standards or the Single UNIX Specifications. But, the format shown above is not correct. A valid setting for TZ will include at least the zone's name and offset from UTC. The normal setting for Texas in the United States would be TZ=CST6CDT (not TZ=CDT ) and TZ=UTC happens to work because the offset from UTC to UTC is 0, but the output from the commands:
TZ=CDT date
TZ=UTC date
will be identical except for the difference in the time zone name. Compare the results above with:
TZ=CST6CDT date
where you'll see a 6 hour difference in time (this time of year) as well as a difference in the time zone name. The output from the above three commands should be something like:
Thu Dec 12 00:17:50 UTC 2013
Thu Dec 12 00:17:50 UTC 2013
Wed Dec 11 18:17:50 CST 2013