Re: [foxboro] Calculating yesterday for shell scripts on SOTM and P91

Kevin,

This 1st URL,
http://www.informatik.uni-frankfurt.de/doc/man/hpux/environ.5.html 
describes the TZ definition syntax (extract below):

>>>quoted text start>>>

      TZ          TZ sets time zone information.  TZ can be set using the
                  format:

                          [:]STDoffset[DST[offset][,rule]]

                     where:

                        STD and DST Three or more bytes that designate the
                                    standard time zone (STD) and summer (or
                                    daylight-savings) time zone (DST) STD is
                                    required.  If DST is not specified,
                                    summer time does not apply in this
                                    locale.

                        offset      offset is the value that must be added
                                    to local time to arrive at Coordinated
                                    Universal Time (UTC).  Offset is of the
                                    form :

                                         hh[:mm[:ss]]

                                    Hour (hh) is any value from 0 through
                                    23.  The optional minutes (mm) and
                                    seconds (ss) fields are a value from 0
                                    through 59.  The hour field is required.
                                    If offset is preceded by a -, the time
                                    zone is east of the Prime Meridian.  A +
                                    preceding offset indicates that the time
                                    zone is west of the Prime Meridian.  The
                                    default case is west of the Prime
                                    Meridian.

<<<quoted text end<<<

This 2nd URL,
http://unix.derkeiler.com/Mailing-Lists/AIX-L/2003-12/0110.html 
describes the "[the TZ trick]" to get tomorrow's date, in the same way you
are 
getting yesterday's. There is an interesting comment though:

>>>quoted text start>>>

It doesn't always give yestday's date. 
eg. TZ=XXX-24 gives tomorrow's (not yesterday) date/time if you are in 
England. 
If you want your own time zone, replace the [-][0-9]* with the value +24 
hours (yes, a "+" value) 
eg. if EST5EDT, use TZ=xxx29 
eg. if JST-9, use TZ=xxx15

<<<quoted text end<<<

The 3rd URL,
http://unix.derkeiler.com/Newsgroups/comp.unix.shell/2006-02/msg00814.html 
puts it all together:

>>>quoted text start>>>

Hi,
Can anyone please tell me what 'aaa' in TZ=aaa24 date +%Y%m%d
stands for. I have searched the unix man pages but not able to get its
meaning.

[...]

as long as you use the format TZ=<string><offset>

<string> will just be some descriptive text that you chose to
describe that rule. As long as you specify an offset (it could
be even more complicated like having two offsets for day light
saving time, and rules to tell when to switch to DST), then the
<string> is not used to define the rules (aaa will not refer to
any description file in /usr/share/zoneinfo contrary to another
contributor said), it will just be used in date +%Z.

So, TZ=aaa24 is a tab zone called "aaa" that is defined as being
offset by 24 wrt Universal time (GMT, UTC).

<<<quoted text end<<<

The statement, yesterday=`TZ=xxx15 date "+%Y-%m-%d"`, will do for you
nicely.

Hope this helps,
Edwin Nasol



 
 
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
 
foxboro mailing list:             http://www.freelists.org/list/foxboro
to subscribe:         mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:      mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
 

Other related posts: