The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
calculate the date of next satureday of current date. rinku Shell Programming and Scripting 3 09-02-2008 11:05 PM
Get date and time for past 1 hour from current date spch2o Shell Programming and Scripting 5 08-29-2008 04:32 AM
Perl: Extracting date from file name and comparing with current date MKNENI Shell Programming and Scripting 4 03-26-2008 04:01 PM
subtracting a days from current date rameshspal Shell Programming and Scripting 1 03-10-2006 01:18 AM
how to find files less than the current date mallikarjuna UNIX for Dummies Questions & Answers 4 01-20-2006 01:49 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-03-2008
ladtony
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
How to find a date which is 7 days past when given current date

hii all.
I have to get the date of the 7th day past from the current date.
if i give the current date as sep 3 then i must get the date as 27th of august.
can we get the values from the "cal" command.
cal | awk '{print $2}' will this type of command work.
actually my need is
if today is wednesday then i want the files of the last wednesday.
please help me out...
  #2 (permalink)  
Old 09-03-2008
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,390
fnsonlq0-/home/fnsonlq0>echo $TZ
IST-5:30
fnsonlq0-/home/fnsonlq0>date
Wed Sep 3 11:18:13 IST 2008
fnsonlq0-/home/fnsonlq0>TZ=IST+168
fnsonlq0-/home/fnsonlq0>date
Wed Aug 27 05:48:21 IST 2008

this might help you..
  #3 (permalink)  
Old 09-03-2008
ladtony
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
will this work for ksh
  #4 (permalink)  
Old 09-03-2008
ladtony
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
i didnt get the commands u gave
can u please be bit more clear
  #5 (permalink)  
Old 09-03-2008
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,390
Quote:
Originally Posted by ladtony View Post
i didnt get the commands u gave
can u please be bit more clear
echo $TZ
whats the o/p you are getting??
  #6 (permalink)  
Old 09-03-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
The idea is to muck with the TZ (time zone) offset to get a date "transported" into a "time zone" which corresponds to the date and time offset you want to calculate.

Anyway, see the FAQ for more on this topic. Yesterdays Date/Date Arithmetic
  #7 (permalink)  
Old 09-03-2008
ladtony
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
hi
i am getting the output as
US/Arizona
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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




All times are GMT -4. The time now is 11:46 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0