grep tomorrow's date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting grep tomorrow's date
# 8  
Old 01-09-2009
Wont work on last day of month:

Code:
 # date -d "2008-01-31" | awk '{print $3 + 1,$2,$6}'
32 Jan 2008

# 9  
Old 01-09-2009
ohhhhh no

Ya, you are right. I missed out that.

thanks.
# 10  
Old 01-09-2009
I am not sure why the solutions given by 'Ikon' is not working. if i execute the script, it's returning the same date

#!/bin/ksh/
#myvar=`date '+%d %b %Y' --date="tomorrow"`
#myvar=`date '+%d %b %Y' --date='-1 days ago'`
myvar=`date '+%d %b %Y' --date="next day"`
echo $myvar

output is 09 JAN 2009

Also, if I used solution of 'SFYNC', i am getting following error

date: illegal option -- d
usage: date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]

Please advise.
# 11  
Old 01-09-2009
You are not using gnu date, your version does not support --date.

Try this:
Code:
TZ=EDT-24 date +"%d %b %Y"

# 12  
Old 01-09-2009
Hi Ikon,

I am getting below output. How can I remove 'US/Eastern; word from the next line. Also could you please explain the code ?

TZ=EDT-24 date +"%d %b %Y"
echo $TZ

OUTPUT

10 Jan 2009
US/Eastern
# 13  
Old 01-09-2009
It works kinda weird, IMO.

TZ=EDT-24 adds 24hours to the time
TZ=EDT+24 Removed 24hours
You probabally want to change TZ to what your time zone actually is.

I dont fully understand how it works. Because +1 doesnt add or subtract 1 hour.
# 14  
Old 01-09-2009
Hi Ikon,

Actually I don't want time zone itself. I need only 'dd mon yyyy'
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Rebuilding computer tomorrow at work

I'm rebuilding my primary computer at work tomorrow. Currently, it has Windows 7. I would like to replace the main system with either Linux or Unix, although I would like to be able to run a fully operational Windows as a VM within that. Any recommendations on which Linux or Unix to go with? I'm... (6 Replies)
Discussion started by: Sean_
6 Replies

2. Shell Programming and Scripting

How to get tomorrow,yesterday date from date Command

Hi I want to get tomorrow and yesterday date from date command. My shell is KSH and server is AIX. I tried several options, but unable to do. Please help on this. Regards Rajesh (5 Replies)
Discussion started by: rajeshmepco
5 Replies

3. Shell Programming and Scripting

Calculating expiry date using date,sed,grep

Hi, I would greatly appreciate it if someone can help me with my problem. I have a crawler which collects spam URLs everyday & this data needs to be published in a blacklist. Here's the catch: The "Time To Live" (TTL) for each URL is 3 months (or whatever for that matter). If i see the... (5 Replies)
Discussion started by: r4v3n
5 Replies

4. Homework & Coursework Questions

hey guys i need our help to be passed tomorrow.

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: log in time and about the recyclebin 2. Relevant commands, code, scripts, algorithms: im not sure what to... (2 Replies)
Discussion started by: skypigeon
2 Replies

5. UNIX for Dummies Questions & Answers

hey guys i need our help for my assignment to be passed tomorrow.

good day to all. im just a new member. since im a newbie in UNIX, im having trouble learning. problem #1 problem # 2 thank you guys. take good care! (1 Reply)
Discussion started by: skypigeon
1 Replies

6. UNIX for Dummies Questions & Answers

Date change to tomorrow

I have this code in a script that says it is calculating current date: cur_date=`date -u +%m/%d/%Y` If the script is run today during the day, it returns 12/11/2008 If the script is run today during the night, it returns 12/12/2008 Why does it return tomorrow's date if it was run at... (2 Replies)
Discussion started by: mkoay
2 Replies

7. UNIX for Dummies Questions & Answers

Have an interview tomorrow just wondering one thing...

Hi, just a quick question here. I have an interview coming up tomorrow. The job is for a UNIX System Admin. I have a degree in Computer Networking and am familiar with Solaris, but was wondering what should I brush up on before going in to this interview (like any online reference)? Thank you... (2 Replies)
Discussion started by: NELS
2 Replies
Login or Register to Ask a Question