unix date command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers unix date command
# 1  
Old 04-09-2004
Question unix date command

Hi there

I am using the following command to get today's date:

Date=`date '+%Y%m%d'`

This has the format 20040409

What I want is today's date -1 i.e. get yesterdays date.

What is the command for this?

Thanks Smilie
# 2  
Old 04-09-2004
there are afew examples of this already been posted on the board.

please try useing the search function first.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX script to replace old date with current date dynamically in multiple files present in a folder

I am trying to work on a script where it is a *(star) delimited file has a multiple lines starts with RTG and 3rd column=TD8 I want to substring the date part and I want to replace with currentdate minus 15 days. Here is an example. iam using AIX server $ cat temp.txt RTG*888*TD8*20180201~... (1 Reply)
Discussion started by: Shankar455
1 Replies

2. HP-UX

awk command in hp UNIX subtract 30 days automatically from current date without date illegal option

current date command runs well awk -v t="$(date +%Y-%m-%d)" -F "'" '$1 < t' myname.dat subtract 30 days fails awk -v t="$(date --date="-30days" +%Y-%m-%d)" -F "'" '$1 < t' myname.dat awk command in hp unix subtract 30 days automatically from current date without date illegal option error... (20 Replies)
Discussion started by: kmarcus
20 Replies

3. Shell Programming and Scripting

Find week of the year for given date using date command inside awk

Hi all, Need an urgent help on the below scenario. script: awk -F"," 'BEGIN { #some variable assignment} { #some calculation and put values in array} END { year=#getting it from array and assume this will be 2014 month=#getting it from array and this will be 05 date=#... (7 Replies)
Discussion started by: vijaidhas
7 Replies

4. Shell Programming and Scripting

Using sed command replace date variable in unix

I need to use a shell script, using sed command how to replace date variable value in following format. 04/18/2012 11:38:55 Because the sed is treating the '/' as a parameter instead of the value of a variable, and hence there is the message as sed: command garbled: s/insert/04/18/2012... (9 Replies)
Discussion started by: jannusuresh
9 Replies

5. Shell Programming and Scripting

hp-unix stat command to get last change date of file

I'm on hp-unix. I would like a variable to hold the last change date of a file. I looked at the man pages for stat, but I don't see any examples and can't get the syntax right. Can anyone help me? Thank you. (2 Replies)
Discussion started by: sboxtops
2 Replies

6. Programming

I need code command(unix) date in c

hello please I need code command date in c I have a projet in my unv I am waiting your enswer:b::b: sorry on my english (1 Reply)
Discussion started by: mahfode
1 Replies

7. Shell Programming and Scripting

Compare date from db2 table to yesterday's Unix system date

I am currently running the following Korn shell script which works fine: #!/usr/bin/ksh count=`db2 -x "select count(*) from schema.tablename"` echo "count" I would like to add a "where" clause to the 2nd line that would allow me to get a record count of all the records from schema.tablename... (9 Replies)
Discussion started by: sasaliasim
9 Replies

8. UNIX for Dummies Questions & Answers

Command DATE in UNIX System

I have a problem... it's possible execute a command DATE with the sintax of LINUX system ??? Example: in Linux i can execute the command line : date -- set "10 minutes" and i have a output the date with the actual date - 10 min. It's possible have the same rusult in the Unix system ????? ... (3 Replies)
Discussion started by: ZINGARO
3 Replies

9. UNIX for Dummies Questions & Answers

Unix Date Command

IS there a way to use the unix date command to find the 2nd Saturday fo every month? Each Month I want to execute a specific command only of the 2nd Saturday. (1 Reply)
Discussion started by: redsoxfan
1 Replies

10. Shell Programming and Scripting

UNIX date command

Hello...I have have the value of date command stored in a particular format in a variable...Is there any way by which I can increment the value of the date using unix only?Until now i was calling an sql query to increment the date.. Thanks (6 Replies)
Discussion started by: tej.buch
6 Replies
Login or Register to Ask a Question