TZ=TZ+28 => date -24hrs with EST5EDT,M03.2.0,M11.1.0 ?


 
Thread Tools Search this Thread
Operating Systems AIX TZ=TZ+28 => date -24hrs with EST5EDT,M03.2.0,M11.1.0 ?
# 1  
Old 06-13-2009
TZ=TZ+28 => date -24hrs with EST5EDT,M03.2.0,M11.1.0 ?

I am trying to find a sure way to get yesterday's date considering that the local time is Montreal Canada.

The current TZ value is EST5EDT,M03.2.0,M11.1.0 on a AIX 4.2

I am wondering if adding 28 to the TZ (in a script) is a sure way even if we change the time in Spring and Fall. The script can be run anytime.

We do not have GNU Date and knowing the client, he might reject the idea of adding any software to the system even if it is Open Source.
# 2  
Old 06-13-2009
I have no system with such an old AIX version at hand, but in an AIX 5.3 system it worked - in a way. See the following terminal session printout for a hint:

Code:
# instfix -i | grep ML
    All filesets for 5.3.0.0_AIX_ML were found.
    All filesets for 5300-01_AIX_ML were found.
    All filesets for 5300-04_AIX_ML were found.
    All filesets for 5300-05_AIX_ML were found.
    All filesets for 5300-06_AIX_ML were found.
    All filesets for 5300-07_AIX_ML were found.
    No filesets which have fixes for 5300-03_AIX_ML are currently installed.
    All filesets for 5300-02_AIX_ML were found.
    All filesets for 5300-08_AIX_ML were found.
    All filesets for 5300-09_AIX_ML were found.

# print - $(TZ=EST5EDT,M03.2.0,M11.1.0; date)   
Sat Jun 13 11:19:47 EDT 2009

NOTE: So far, this is normal and to be expected. But i noticed, that arithmetics involving numbers revert all
      TZ-codes back to CUT. See the following four commands. There is no difference between "CUT+28", "+28"
      and "EST5EDT+28".

# print - $(TZ=EST5EDT+24,M03.2.0,M11.1.0; date)
Fri Jun 12 15:19:54 EDT 2009
# print - $(TZ=EST5EDT+28,M03.2.0,M11.1.0; date)
Fri Jun 12 11:20:21 EDT 2009
# print - $(TZ=CUT+28,M03.2.0,M11.1.0; date)    
Fri Jun 12 11:20:56 CUT 2009
# print - $(TZ=+28,M03.2.0,M11.1.0; date)   
Fri Jun 12 11:21:09 2009

Now, i am not root on this machine and can't therefore change the date. You could easily try these commands on a test system you have control over and play with the system date to find out if the DST-settings are being honored or not.

The way i put the commands does limit the changed TZ-setting to the single invocation of "date" each.

I hope this helps.

bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Answers to Frequently Asked Questions

Compare date in .txt with system date and remove if it's lesser than system date

I m working on shell scripting and I m stuck where in my .txt file there is column as expiry date and I need to compare that date with system date and need to remove all the rows where expiry date is less than system date and create a new .txt with update. (1 Reply)
Discussion started by: Stuti
1 Replies

2. UNIX for Beginners Questions & Answers

Compare date in .txt with system date and remove if it's lesser than system date

Can someone help me with the code wherein there is a file f1.txt with different column and 34 column have expiry date and I need to get that and compare with system date and if expiry date is <system date remove those rows and other rows should be moved to new file f2.txt . I don't want to delete... (2 Replies)
Discussion started by: Stuti
2 Replies

3. Shell Programming and Scripting

Date: invalid date trying to set Linux date in specific format

i try to set linux date & time in specific format but it keep giving me error Example : date "+%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01" or date +"%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01" keep giving me this error : date: invalid date ‘19-01-2017 00:05:01' Please use CODE tags... (7 Replies)
Discussion started by: umen
7 Replies

4. Shell Programming and Scripting

To get the time exactly 24hrs from the current time

Hi guys, I am having file which contains below data. 2012-04-24 08:40:13 10739022730 1027699274PersonInfoShipTO details missing FirstName,LastName, 2012-04-24 08:40:13 10739022730 1027699274PersonInfoShipTO details missing FirstName,LastName, 2012-04-24 08:40:13 ... (2 Replies)
Discussion started by: mohanalakshmi
2 Replies

5. Shell Programming and Scripting

Converting a date to friday date and finding Min/Max date

Dear all, I have 2 questions. I have a file with many rows which has date of the format YYYYMMDD. 1. I need to change the date to that weeks friday date(Ex: 20120716(monday) to 20120720). Satuday/Sunday has to be changed to next week friday date too. 2. After converting the date to... (10 Replies)
Discussion started by: 2001.arun
10 Replies

6. Shell Programming and Scripting

Date One Week Ago From Given Date, Not From Current Date

Hi all, I've used various scripts in the past to work out the date last week from the current date, however I now have a need to work out the date 1 week from a given date. So for example, if I have a date of the 23rd July 2010, I would like a script that can work out that one week back was... (4 Replies)
Discussion started by: Donkey25
4 Replies

7. UNIX for Dummies Questions & Answers

Download image every 24hrs + put it in php site

Hi everyone, I am all new to this and I might not know what I am asking about :) I have access to a cPanel with cron tab scheduler. I know nothing re scripting creating php etc.. I own a ftp mainly for own email address, some storage, and a forum (ready-made one :P ) I have some knowledge... (5 Replies)
Discussion started by: zYx
5 Replies

8. Shell Programming and Scripting

Easy way to conver GMT to EST5EDT

I have a tool that outputs its date as YYyymmddHHMMSS GMT. Does anyone know a simple way to convert this to EST5EDT using ksh? (1 Reply)
Discussion started by: 2dumb
1 Replies

9. Shell Programming and Scripting

RE:backup files older then 24hrs to a new directory .

How do you move (mv) files to a backup directory from a particular directory when the files are older the 24hrs copied from a batch script run every 24 hrs. Would you use find or some kind of timestamp.timestamp="$(date +'%m%d%I%M')" (2 Replies)
Discussion started by: amceyeson
2 Replies
Login or Register to Ask a Question