Sponsored Content
Top Forums Shell Programming and Scripting How to configure time zone using POSIX format in Centos 5? Post 302746471 by DGPickett on Wednesday 19th of December 2012 12:15:22 PM
Old 12-19-2012
PERL has an embedded db that might help: cgi - Get time zone abbreviation using POSIX (Perl) - Stack Overflow

The Olson DB escribed: tz database - Wikipedia, the free encyclopedia

Noe GMT-14 is UTC + 14 hours is UTC - 10 hours is, according to the database:
List of tz database time zones - Wikipedia, the free encyclopedia
it is HST, so you would set TZ to HTC-10 or something like that. POSIX offset sign is backward of TZ: GMT/UTC standards reversed in timezone standards (and PHP, and wordpress, and Unix/Posix) | Stef's Blog

Of course, you might be off a day!
Code:
$ ( echo $TZ ; date ; TZ=GMT-14 ; date )
EST5EDT
Wed Dec 19 12:19:32 EST 2012
Thu Dec 20 07:19:32 GMT 2012
$ ( echo $TZ ; date ; TZ=GMT+14 ; date )
EST5EDT
Wed Dec 19 12:20:14 EST 2012
Wed Dec 19 03:20:14 GMT 2012
$ ( echo $TZ ; date ; TZ=GMT14 ; date )
EST5EDT
Wed Dec 19 12:21:18 EST 2012
Wed Dec 19 03:21:18 GMT 2012
$ ( echo $TZ ; date ; TZ=Pacific/Kiritimati ; date )
EST5EDT
Wed Dec 19 12:26:52 EST 2012
Wed Dec 19 17:26:52 Pacific/Kiritimati 2012
$ ( echo $TZ ; date ; TZ=Pacific/Kiritimati-14 ; date )
EST5EDT
Wed Dec 19 12:27:50 EST 2012
Thu Dec 20 07:27:50 Pacific/Kiritimati 2012
$

So, TZ sets the visible name, for which there should be a table of 3 place capital letter codes for every offset, but apparently there is not. Using more than 3 places may work some places.

Last edited by DGPickett; 12-19-2012 at 01:30 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert Epoch time format to normal date time format in the same file

I have a file named "suspected" with series of line like these : {'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '219.78.120.166', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 8291, 'time': 1226506312L, 'serverhostname': ''} {'protocol': 17, 'service': 'BitTorrent... (3 Replies)
Discussion started by: rk4k
3 Replies

2. Red Hat

configure dns in centos

Hi, how do I set the DNS in centos. I don't mean of creating DNS server, but setting what should be the DNS server of centos. I mean to what server he should go in order to translate url into ip (6 Replies)
Discussion started by: programAngel
6 Replies

3. Linux

How to Install and configure Jira And Confulence in Centos 5.5

Please Give me Step by step Instruction Or Video Tutorial For installing and configuring Jira And Confulence in Centos 5.5 , What are the Requirements For Installing and Configuring , wht are the Softwares need for it to work perfectly ... pls reply thanks in advance .... :wall: (1 Reply)
Discussion started by: babinlonston
1 Replies

4. Red Hat

Cannot configure TL-WN727N wireless usb in centos 6.2

hi everybody, iam using 32 bit centos 6.2 on my machine. i have purchase TP-LINK, TL-WN727N wireless usb, but i was not able to install on my desktop. i was not able to find drivers for centos 6.2 official site of TPLINK. $ uname -a Linux workstation 2.6.32-220.el6.i686 #1 SMP Tue Dec 6... (0 Replies)
Discussion started by: paruhang
0 Replies

5. Solaris

how to configure a audit in global zone that will audit all the zone

Hi everyone, how i can configure a single audit service in the global zone for all zones, on solaris BSM. I will be glad to hear back from you. Thanks and Regards (3 Replies)
Discussion started by: ladondo
3 Replies

6. Solaris

modifying date and time and time zone on solaris 5.10 with (redundant server) veritas

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

7. Solaris

showing 2 different time zones in global zone and nonglobal zone

can some one help me out as it is showing 2 different time zones in global zone and nonglobal zone .In global zone it is showing in GMT while in nonglobal zone i it showing as PDT. System in running with solaris 10 (3 Replies)
Discussion started by: ravijanjanam12
3 Replies

8. Shell Programming and Scripting

Convert UTC time into current UNIX sever time zone

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... (5 Replies)
Discussion started by: mohanalakshmi
5 Replies

9. Red Hat

How can i configure ipv6 on centos?

HI Forum, i was trying to configure ipv6 on my centos box with 2 physical interface bonded as bond0. what all things need to change? Regards, Ben (0 Replies)
Discussion started by: bentech4u
0 Replies

10. Solaris

Configure Solaris zone on new network

Hi, I have a Solaris 10 zone which I need to configure on a new network. I have configured the new IP on the zone itself and I can ping the interface from a node on the same network, but not from another network. Basically I need to know how to route the traffic from the zone to it's... (3 Replies)
Discussion started by: sparcman
3 Replies
zdump(1M)						  System Administration Commands						 zdump(1M)

NAME
zdump - time zone dumper SYNOPSIS
zdump [-v] [-c cutoffyear] [zonename...] DESCRIPTION
The zdump command prints the current time for each time zone (zonename) listed on the command line. Specify zonename as the name of the time zone database file relative to /usr/share/lib/zoneinfo. Specifying an invalid time zone (zonename) to zdump does not return an error, rather zdump uses GMT. This is consistent with the behav- ior of the library calls; zdump reflects the same behavior of the time routines in libc. See ctime(3C) and mktime(3C). OPTIONS
The following options are supported: -v Displays the entire contents of the time zone database file for zonename. Prints the time at the lowest possible time value; the time one day after the lowest possible time value; the times both one second before and exactly at each time at which the rules for computing local time change; the time at the highest possible time value; and the time at one day less than the highest possible time value. See mktime(3C) and ctime(3C) for information regarding time value (time_t). Each line of output ends with isdst=1 if the given time is Daylight Saving Time, or isdst=0 otherwise. -c cutoffyear Cuts off the verbose output near the start of the year cutoffyear. EXIT STATUS
The following exit values are returned: 0 Successful completion. 1 An error occurred. FILES
/usr/share/lib/zoneinfo Standard zone information directory ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
zic(1M), ctime(3C), mktime(3C), attributes(5), environ(5) SunOS 5.10 19 May 1997 zdump(1M)
All times are GMT -4. The time now is 03:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy