![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shell Script To increment Date*HElp*** | niceboykunal123 | Shell Programming and Scripting | 1 | 04-23-2008 02:05 AM |
| Date Formatting in Shell Script | Isiva | UNIX for Advanced & Expert Users | 2 | 07-10-2007 10:20 AM |
| Specify a previous date as start date in shell script | ritzwan0 | Shell Programming and Scripting | 2 | 09-25-2006 06:58 PM |
| Shell script: last modification date for a file | onlyc | UNIX for Dummies Questions & Answers | 4 | 07-06-2006 02:01 PM |
| How to subtract 2 hours from 'date' in shell ( /bin/sh ) script ? | yairon | UNIX for Dummies Questions & Answers | 1 | 06-07-2001 04:23 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Identifying prior date in shell script
Hi guys,
I'm a newbie to shell script. I have to write a shell script that is supposed to give me a date which should be older than the current date when I supply "no. of days" as a command line parameter to the script. (i.e)., if I am giving the no. of days value as 305, the script should give me the answer as date which is 305 days before today's date. The date can be in any format dd-mm-yyyy or mm/dd/yyyy, that is not a problem. simply: (today's date – no of days) >>> should give the older date. Looking forward to your "flooding" responses. Thanks |
|
|||||
|
In this post you will find all sort of date manipulation:
Yesterdays Date/Date Arithmetic |
|
||||
|
shell date conversion
hi royalibrahim,
take a look at gnu-date. it has some very powerfull date conversion built-in. You can say stuff like: date -d "10 day ago" what make scripts very readable (as long you understand english). I use the -d option very often to convert different date formats from programm to something our database likes. |
|
||||
|
GNU date problem
Hi, I have come across this weird behaviour of GNU date. Code:
date -d "21-May-08 09:29 1 minute" +"%d-%b-%y %H:%M" gives output: 21-May-08 09:30 --> Note: I have given here the abbreviated month name format specifier '%b' But, Code:
date -d "21-05-08 09:29 1 minute" +"%d-%m-%y %H:%M" gives output: 08-05-21 09:30 --> I mean the year and the date field is jumbled, though I have given the correct format specifier '%m' for the month field. How to make it work? |
![]() |
| Bookmarks |
| Tags |
| shell script, shell scripting, unix scripting, unix scripting basics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|