The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Get Day of Week from date vpapaiya HP-UX 5 03-07-2008 01:47 PM
How to find Day of the Week from the given date (Perl)? deepakwins UNIX for Dummies Questions & Answers 5 03-07-2008 01:45 PM
check file date in one week ??? sabercats Shell Programming and Scripting 1 03-16-2006 05:43 AM
How to identify week-1 and week-2 csaha Shell Programming and Scripting 1 02-16-2006 02:24 AM
calcuate the week number of a given date ahmedwaseem2000 Shell Programming and Scripting 11 09-11-2005 09:41 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-11-2007
Registered User
 

Join Date: Oct 2007
Posts: 1
get date of Thursday of any week

I need to be able to use a date in this format yyyymmdd to return the date of the Thursday of that week in the same format. Appreciate any help!
Reply With Quote
Forum Sponsor
  #2  
Old 10-12-2007
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
try datecalc:
Yesterdays Date/Date Arithmetic
Reply With Quote
  #3  
Old 10-21-2007
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
To elaborate a bit:
Code:
$ cat thursday
#! /usr/bin/ksh
alias datecalc=./datecalc
typeset -L4 y
typeset -L2 m
typeset -R2 d
read ans?"enter yyyymmdd - "
y=$ans
ans=${ans#$y}
m=$ans
d=$ans
echo $y $m $d
j=$(datecalc -j $y $m $d)
(( offset = 4-$(datecalc -d $y $m $d) ))
datecalc -j $((j+offset))
exit 0
$ ./thursday
enter yyyymmdd - 19701228
1970 12 28
1970 12 31
$
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:58 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0