![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#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!
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
try datecalc:
Yesterdays Date/Date Arithmetic |
|
#3
|
||||
|
||||
|
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
$
|
||||
| Google The UNIX and Linux Forums |