nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Shell date command for manipulation and formatting date

This is a discussion on Shell date command for manipulation and formatting date within the Shell scripting forums, part of the Development/Scripting category; This will give a date using date utility to find next day for system date in a particular format . ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 01-30-2008, 03:12 AM
Junior Member
User
 
Join Date: Jan 2008
My distro: Debian
Posts: 1
Rep Power: 0
newbie4 is on a distinguished road
Default Shell date command for manipulation and formatting date

This will give a date using date utility to find next day for system date in a particular format .
date --date='next day' "+%Y%m%d" .

in the same way i need a output to get the next day or next month for any date which the user is passing as a parameter $1.
Say $1 (i pass as $1 as23/12/2007 then i need the 5 day of 23/12/2007 i.e output /result 28/12/2007)

something like this below

mydate=$1
date --date $mydate +%m%d%Y -d ýesterday (this does not work)

Is it possible ? if so pls give me the soln/command .

Thks
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-30-2008, 01:21 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Any distro with shell
Posts: 964
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Have your tried yest?
Download of the day: Easy date manipulation with yest utility under Linux/UNIX
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Run mv command from ftp shell script subin Shell scripting 6 05-02-2008 09:44 AM
How to calculate date minus 72 hours? svinopas Shell scripting 1 10-09-2007 09:37 PM
script to ping + date dendi_rm Shell scripting 3 09-11-2007 10:42 AM
running command a root in shell scripts chiku Shell scripting 1 07-17-2006 06:39 PM
How can I rename a file by its date? warren Linux software 5 03-30-2006 12:11 PM


All times are GMT +5.5. The time now is 11:00 AM.


Powered by vBulletin® Version 3.7.3 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36