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
Date::Parse(3)						User Contributed Perl Documentation					    Date::Parse(3)

NAME
Date::Parse - Parse date strings into time values SYNOPSIS
use Date::Parse; $time = str2time($date); ($ss,$mm,$hh,$day,$month,$year,$zone) = strptime($date); DESCRIPTION
"Date::Parse" provides two routines for parsing date strings into time values. str2time(DATE [, ZONE]) "str2time" parses "DATE" and returns a unix time value, or undef upon failure. "ZONE", if given, specifies the timezone to assume when parsing if the date string does not specify a timezone. strptime(DATE [, ZONE]) "strptime" takes the same arguments as str2time but returns an array of values "($ss,$mm,$hh,$day,$month,$year,$zone)". Elements are only defined if they could be extracted from the date string. The $zone element is the timezone offset in seconds from GMT. An empty array is returned upon failure. MULTI-LANGUAGE SUPPORT Date::Parse is capable of parsing dates in several languages, these include English, French, German and Italian. $lang = Date::Language->new('German'); $lang->str2time("25 Jun 1996 21:09:55 +0100"); EXAMPLE DATES
Below is a sample list of dates that are known to be parsable with Date::Parse 1995:01:24T09:08:17.1823213 ISO-8601 1995-01-24T09:08:17.1823213 Wed, 16 Jun 94 07:29:35 CST Comma and day name are optional Thu, 13 Oct 94 10:13:13 -0700 Wed, 9 Nov 1994 09:50:32 -0500 (EST) Text in ()'s will be ignored. 21 dec 17:05 Will be parsed in the current time zone 21-dec 17:05 21/dec 17:05 21/dec/93 17:05 1999 10:02:18 "GMT" 16 Nov 94 22:28:20 PST LIMITATION
Date::Parse uses Time::Local internally, so is limited to only parsing dates which result in valid values for Time::Local::timelocal. This generally means dates between 1901-12-17 00:00:00 GMT and 2038-01-16 23:59:59 GMT BUGS
When both the month and the date are specified in the date as numbers they are always parsed assuming that the month number comes before the date. This is the usual format used in American dates. The reason why it is like this and not dynamic is that it must be deterministic. Several people have suggested using the current locale, but this will not work as the date being parsed may not be in the format of the current locale. My plans to address this, which will be in a future release, is to allow the programmer to state what order they want these values parsed in. AUTHOR
Graham Barr <gbarr@pobox.com> COPYRIGHT
Copyright (c) 1995-2009 Graham Barr. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 325: You forgot a '=back' before '=head1' perl v5.18.2 2009-12-12 Date::Parse(3)
All times are GMT -4. The time now is 12:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy