![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Function to find day of any given date. | RRVARMA | Shell Programming and Scripting | 5 | 05-12-2008 12:19 AM |
| Date Function | charandevu | Shell Programming and Scripting | 1 | 04-02-2008 06:12 AM |
| Date Function | charandevu | Shell Programming and Scripting | 1 | 04-02-2008 04:44 AM |
| Wrong date function | Asteroid | Shell Programming and Scripting | 3 | 04-04-2007 01:09 AM |
| date function | abey | Shell Programming and Scripting | 2 | 02-27-2006 02:28 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#8
|
|||
|
|||
|
AIX has ksh93, so the following should work
Code:
$ printf "%T\n" "01012008" Tue Jan 1 20:08:00 EST 2008 $ printf "%T\n" "01012008 last saturday" Sat Dec 29 20:08:00 EST 2007 $ printf "%T\n" "01012008 next sunday" Sun Jan 13 20:08:00 EST 2008 $ printf "%T\n" "01012008 this sunday" Sun Jan 6 20:08:00 EST 2008 $ |
| Forum Sponsor | ||
|
|
|
#9
|
|||
|
|||
|
Hello All for all your feedback.
I tried "fpmurphy" suggestion in regards to ksh93 but it doesn't appear that this has been installed on our aix server. I did find a useful code that's doing a similar calculation to find "last Sunday" from an input date but it's written in Perl. Can someone assist me in converting it to a shell script? We also do not have Perl available here. http://www.unix.com/unix-dummies-que...sing-perl.html Thank you. |
|
#10
|
|||
|
|||
|
Quote:
What is the output of "print $KSH_VERSION" and "print ${.sh.version}" |
|
#11
|
|||
|
|||
|
AIX Version 5.2
$ print $KSH_VERSION $ print ${.sh.version} Version M-12/28/93e I tried your example below and I get the following error: printf "%T\n" "01012008" ksh93: printf: T: unknown format specifier Thank you. |
|
#12
|
|||
|
|||
|
Quote:
|
|
#13
|
|||
|
|||
|
Thanks fpmurphy for your quick reply....
Unfortunately, I'm not part of the Unix team system administrators and whichever versions they decide to install on the server is up to them. So, is there any other options for me??? |
|
#14
|
|||
|
|||
|
I'm thinking of a potential solution - can you let me know if this will work or not?
Question: For any given date, get previous Saturday's date. Solution: Current date => convert to julian date (A) (for example: 205 for today's date) Current date => get day of the week (B) (for example: 3 for today's date) Previous Saturday = (A)-(B)-1 (since sunday = 0) <= (205 - 3)-1 = 201 Then convert julian date format back to calendar date format.....is there an easy way to do this? Thanks. |
|||
| Google The UNIX and Linux Forums |