![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Function to find day of any given date. | RRVARMA | Shell Programming and Scripting | 5 | 05-12-2008 03:19 AM |
| Date Function | charandevu | Shell Programming and Scripting | 1 | 04-02-2008 09:12 AM |
| Date Function | charandevu | Shell Programming and Scripting | 1 | 04-02-2008 07:44 AM |
| Wrong date function | Asteroid | Shell Programming and Scripting | 3 | 04-04-2007 04:09 AM |
| date function | abey | Shell Programming and Scripting | 2 | 02-27-2006 05:28 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
Hi there. Hi frndz, I have to script a shell in such a way that by giving the current date, it should give the previous saturday date and next sunday date as output. eg: Input - 01-01-2008 O/p - last saturady- 30-12-2007(ddmmyy) Next Sunday- 05-01-2008 Please help me in finding hw to do do it..plz......... |
|
||||
|
Please understand that I do not mean to distract from your desire for a script, but this is an excellent example, I think, of something which is bothersome with scripting but simple and straightforward with a C compiler. time(), localtime(), and the other date subroutines all give us excellent means to do this. perl or php also let you do fun things with dates. the UNIX "date" function kinda works with "now", unless of course you use the [-d|--date] option, but I don't see a simple way to make that work either. I had thought that if "date -d" would accept a julian date, then one could subtract a value related to the +%w value, but my CentOS 5 date program wouldn't take a julian date as input.
Sorry, I guess I just spoiled myself by writing C to do things like this. IMHO you might want to consider writing something in C, then using it as your date generator. If you are not comfortable with that, then perhaps perl or php might be helpful. Both are very powerful tools. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| date, datecalc, linux, shell script, solaris |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|