Sponsored Content
Full Discussion: Timezone in +/-HHMM format
Top Forums Shell Programming and Scripting Timezone in +/-HHMM format Post 302165610 by adderek on Friday 8th of February 2008 09:33:10 AM
Old 02-08-2008
$ /opt/exp/gnu/bin/date +%z
-0500
$ /opt/exp/gnu/bin/date +%Z
EST

Make sure you are using GNU date.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Timezone

Hello again, under hp-ux i have a file /etc/TIMEZONE. here is definied which timezone i am. i dont know who reads this file to set after reading the timezone under /usr/lib/tztab. my 2 questions, who reads the file /etc/TIMEZONE ( which service ) and do i need in the first line to set my... (6 Replies)
Discussion started by: ortsvorsteher
6 Replies

2. UNIX for Dummies Questions & Answers

Timezone

Hi, I got an question about changing timezone thrue command line on a SunOS Release 4.1.2 without restarting the computer. Now it's set on WET and I want to set the timezone to CET (GMT +1) Plz somebody help me. Regards Novisern:confused: (5 Replies)
Discussion started by: Novisern
5 Replies

3. UNIX for Dummies Questions & Answers

timezone

Hi, i am searching to change the timezone on a HP-UX11 system. Since last weekend the summertime started i am not able to change the time to the new time, every day the time changes back to wintertime. I think the problem is that the server is on the wrong timezone. Can someone help me please?... (1 Reply)
Discussion started by: eddyvdv
1 Replies

4. UNIX for Advanced & Expert Users

Timezone

HI ; I got Solaris8 installed oon Sunfire V440 .I have TZ=GMT in /etc/TIMEZONE , but when i log in as root i see the date in GMT+1. So i have every time to "set TZ=GMT ; export $TZ" . How can i set the TZ=GMT at the startup defenitely. Thanks :) (7 Replies)
Discussion started by: oss
7 Replies

5. Solaris

Crontab and timezone

I am running SunOS 5.6. If I login with a ksh shell and type 'date'. I get the correct date and time related to the TZ, that is, >Tuesday July 27 09:50:25 NZST 2004 However, if I run under crontab, I get this. >Mon Jul 26 20:49:00 ESTEDT 2004 My question is; Does anyone know how to fix this... (2 Replies)
Discussion started by: lbeard
2 Replies

6. AIX

Timezone Setting

Hi On several AIX 5.3 LPARs the timezone is currrently set to: TZ=NZST-12NZDT,M9.5.0/02:00,M4.1.0/03:00 Daylight savings in NZ starts on Sun 28th Sep 2008, which is the fourth Sunday. Do I need to change my TZ variable to NZST-12NZDT,M9.4.0/02:00,M4.1.0/03:00 or will AIX interpret the fifth... (2 Replies)
Discussion started by: KiwiP
2 Replies

7. Shell Programming and Scripting

Timezone not changed.

Hi All, While installing Red Hat Linux, I tried changing the timezone to Japan for testing.But the timezone was not set to Japan. I tried other timezones , but they didn't work as well. I am guessing the problem might be due to some missing rpm.Does anyone has any idea or faced a similar... (1 Reply)
Discussion started by: nua7
1 Replies

8. Solaris

TIMEZONE problem..

hii there... can you guys help me with TIMEZONE setting on my solaris box i tried to edit cat /etc/TIMEZONE..but i think it will work after rebooting, but something i did which took me to GMT my problem is i have this issue on a server, and i have to fix this without rebooting. thanks for... (1 Reply)
Discussion started by: 6pound
1 Replies

9. UNIX for Dummies Questions & Answers

Need help with Timezone locale.

HI Gurus, I have a issue. One of our applications needs the data loads with the timezone (CST) but our zones run on GMT. I tried to change the TZ value under /etc/default/init value but it seems to effect the the whole zone. Is there any way I can just set up the TZ as CST for a particular user.... (2 Replies)
Discussion started by: rama krishna
2 Replies

10. HP-UX

Getting numeric timezone on HP-UX

Hi I thought the UNIX command date is universal and so I have been using date +%z to get the numberic timezone offset (e.g. -0500) however on HP-UX, this is not returning expected results; on my machine it returns the name of the time zone (e.g. EST) not numbers. does anyone know... (2 Replies)
Discussion started by: flagman5
2 Replies
date(1) 							   User Commands							   date(1)

NAME
date - write the date and time SYNOPSIS
/usr/bin/date [-u] [+format] /usr/bin/date [-a [-]sss.fff] /usr/bin/date [-u] [ [mmdd] HHMM | mmddHHMM [cc] yy] [.SS] /usr/xpg4/bin/date [-u] [+format] /usr/xpg4/bin/date [-a [-]sss.fff] /usr/xpg4/bin/date [-u] [ [mmdd] HHMM | mmddHHMM [cc] yy] [.SS] DESCRIPTION
The date utility writes the date and time to standard output or attempts to set the system date and time. By default, the current date and time is written. Specifications of native language translations of month and weekday names are supported. The month and weekday names used for a language are based on the locale specified by the environment variable LC_TIME. See environ(5). The following is the default form for the "C" locale: %a %b %e %T %Z %Y For example, Fri Dec 23 10:10:42 EST 1988 OPTIONS
The following options are supported: -a [-]sss.fff Slowly adjust the time by sss.fff seconds (fff represents fractions of a second). This adjustment can be positive or negative. The system's clock is sped up or slowed down until it has drifted by the number of seconds specified. Only the super-user may adjust the time. -u Display (or set) the date in Greenwich Mean Time (GMT--universal time), bypassing the normal conversion to (or from) local time. OPERANDS
The following operands are supported: +format If the argument begins with +, the output of date is the result of passing format and the current time to strftime(). date uses the conversion specifications listed on the strftime(3C) manual page, with the conversion specification for %C determined by whether /usr/bin/date or /usr/xpg4/bin/date is used: /usr/bin/date Locale's date and time representation. This is the default output for date. /usr/xpg4/bin/date Century (a year divided by 100 and truncated to an integer) as a decimal number [00-99]. The string is always terminated with a NEWLINE. An argument containing blanks must be quoted; see the EXAMPLES section. mm Month number dd Day number in the month HH Hour number (24 hour system) MM Minute number SS Second number cc Century (a year divided by 100 and truncated to an integer) as a decimal number [00-99]. For example, cc is 19 for the year 1988 and 20 for the year 2007. yy Last two digits of the year number. If century (cc) is not specified, then values in the range 69-99 shall refer to years 1969 to 1999 inclusive, and values in the range 00-68 shall refer to years 2000 to 2068, inclusive. The month, day, year number, and century may be omitted; the current values are applied as defaults. For example, the following entry: example% date 10080045 sets the date to Oct 8, 12:45 a.m. The current year is the default because no year is supplied. The system operates in GMT. date takes care of the conversion to and from local standard and daylight time. Only the super-user may change the date. After successfully setting the date and time, date displays the new date according to the default format. The date command uses TZ to determine the correct time zone information; see environ(5). EXAMPLES
Example 1 Generating Output The following command: example% date '+DATE: %m/%d/%y%nTIME:%H:%M:%S' generates as output DATE: 08/01/76 TIME: 14:45:05 Example 2 Setting the Current Time The following command sets the current time to 12:34:56: example# date 1234.56 Example 3 Setting Another Time and Date in Greenwich Mean Time The following command sets the date to January 1st, 12:30 am, 2000: example# date -u 010100302000 This is displayed as: Thu Jan 01 00:30:00 GMT 2000 ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of date: LANG, LC_ALL, LC_CTYPE, LC_TIME, LC_MESSAGES, and NLSPATH. TZ Determine the timezone in which the time and date are written, unless the -u option is specified. If the TZ variable is not set and the -u is not specified, the system default timezone is used. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: /usr/bin/date +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |enabled | +-----------------------------+-----------------------------+ /usr/xpg4/bin/date +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWxcu4 | +-----------------------------+-----------------------------+ |CSI |enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
strftime(3C), attributes(5), environ(5), standards(5) DIAGNOSTICS
no permission You are not the super-user and you tried to change the date. bad conversion The date set is syntactically incorrect. NOTES
If you attempt to set the current date to one of the dates that the standard and alternate time zones change (for example, the date that daylight time is starting or ending), and you attempt to set the time to a time in the interval between the end of standard time and the beginning of the alternate time (or the end of the alternate time and the beginning of standard time), the results are unpredictable. Using the date command from within windowing environments to change the date can lead to unpredictable results and is unsafe. It can also be unsafe in the multi-user mode, that is, outside of a windowing system, if the date is changed rapidly back and forth. The recommended method of changing the date is 'date -a'. Setting the system time or allowing the system time to progress beyond 03:14:07 UTC Jan 19, 2038 is not supported on Solaris. SunOS 5.11 11 May 2004 date(1)
All times are GMT -4. The time now is 05:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy