AIX DateTime Computation

Login or Register for Dates, Times and to Reply

Thread Tools Search this Thread
Operating Systems AIX AIX DateTime Computation
# 1  
AIX DateTime Computation

Good day people,

Kindly advice on below please.

1) Formatting/ Arithmetic operation of given date

I understand from the AIX man date and some research that flag -d is not applicable for AIX shell scripting and some of the UNIX command date command is not available in AIX.
Please advice if there is any possible way for me to perform the identical operation in the following command on AIX.

echo $(($(($(date -d "2010-06-01" "+%s") - $(date -d "2010-05-15" "+%s"))) / 86400)) >> $2
date -d 'last week' >> $2
date -d "2010-01-01 +10 days" +"# %Y-%m-%d" >> $2
date -d "2011/07/13" +%j >> $2

2) Retrieve the first day and last day of month by a Julian date given.
I understand that Julian date of Now could be retrieved as following command.
date +"%r %a %d %h %y (Julian Date: %j)" >> $2
However, if there any function that I could retrieve the first day and last day of month by a Julian date given ?
Otherwise I will try to write a function to fulfill this requirement instead which might involve some regex and conditional case.

I noticed most of the suggestion solution across from research on this is writing a Perl script.. please advice if there is any other work around or AIX command that I can try on...

Appreciate for any advice.
Thank you.
# 2  
Hello cielle,

Have you searched the board for date & time functionality? There are several threads that should lead you to what you want to do.

On the flip side, being AIX you can mess about with the TZ variable quite successfully. Up to AIX 6.1 (I haven't got a 7 implementation to test on) one can play with the offset used in TZ to move the relative clock around:-
TZ="GMT168BST"             # Move clock back 168 hours, or 7x24, i.e. one week.  Adjust to your time-zone needs, of course.

You may also get some joy with the following snippits of code:-
#Converts time in seconds to human readable time
perl -e 'print scalar localtime $ARGV[0],"\n" ' 12345678

#Converts almost human format time to seconds
perl -e 'use Time::Local; print timelocal(18,21,22,23,4,1970), "\n";'

Note that the format for the second conversion is:-
seconds, minutes, hours, day-of-month, month less one, year
It works for me on AIX

I would love to offer something on Julian date. For more useful in an IT world, but sadly I do not know of a neat answer. It's on the board if you search though.


Last edited by rbatte1; 04-15-2014 at 07:50 AM.. Reason: Spleling
This User Gave Thanks to rbatte1 For This Post:
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #333
Difficulty: Easy
Linux was first developed as an alternative to Windows XP.
True or False?

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Filename with datetime

Hello All, I need unix command to generate a file with datetime in it. For example : ABC_YYYYMMDDHH24MISS.txt Regards Biswajeet Ghosh (1 Reply)
Discussion started by: bghosh
1 Replies

2. Shell Programming and Scripting

How to compare datetime?

Hi, To get the batch status, I will need to check if the particular job started after 5PM. if the job start time is before 5 pm, then it means that the job has not started for this particular date. I will run the script with date as argument. For eg: BS 07/10/2012 Start time from the log is... (8 Replies)
Discussion started by: ajayakunuri
8 Replies

3. Shell Programming and Scripting

datetime difference in seconds

Hi, I'm trying to find processing time of my script. Please can someone give me the commands to get the start/end time in "dd-mm-yyyy hh:mm:ss" and the differnce in seconds. Thanks! (5 Replies)
Discussion started by: dvah
5 Replies

4. Programming

computation migration

Hi, i need a code to implement computation migration in c. Can you guys help me out?? (3 Replies)
Discussion started by: tanvi
3 Replies

5. AIX

How to create a filesystem with the correct computation of PP

Hi everyone, im having a problem with the computation of the PP size for creating a filesystem. for example my requirement is to create a new filesystem with 10gig of system on aix 5.1 and aix 5.3 system. here's the result when i run lsvg vgSAN-sparkle could any provide me an exact... (3 Replies)
Discussion started by: cwiggler
3 Replies

6. Shell Programming and Scripting

Hi, I'm trying to use function in Perl. I do not have in the library. Is there a way to get it and put it into library? Thanks, George. (1 Reply)
Discussion started by: gpaulose
1 Replies

7. Shell Programming and Scripting

Computation Problem

Hi Folks I have a file with the following sample input 919416586748,1200,31200 919416283619,3521,33521 919416811900,2440,64940 919416576012,13670,43670 Now i want to subtract the second value (where , is field separator) from the third value and display the output as follows ... (3 Replies)
Discussion started by: PradeepRed
3 Replies