I want a function/script which returns the weekday of the given date.
the input to the function/script is the date with format MM/DD/YYYY, it should return the weekday as 1 for sunday, 2 for monday .......7 for saturday.
ex: if the function called like this date_func 12/15/2005
it should return 5 (thursday)
"The Julian day or Julian day number (JDN) is the number of days that have elapsed since 12 noon Greenwich Mean Time (UT or TT) on Monday, January 1, 4713 BC in the proleptic Julian calendar."
datecalc is using the modified julian day number:
"The Modified Julian Day (MJD), introduced by the Smithsonian Astrophysical Observatory in 1957 to record the orbit of Sputnik, is defined in terms of the Julian day as follows: MJD = JD - 2400000.5 The offset of 0.5 means that MJD started at midnight at the beginning of November 17, 1858, and that every Modified Julian Day begins and ends at midnight UT or TT."
The author of the date program you are using has confused day-of-year with julian day:
"The use of Julian date to refer to the day-of-year (ordinal date) is usually considered to be incorrect."
thanks for the info ...i really use to think that julian day refer to (what you say) day-of-year...
so my next obvious question is how to get day-of-year from datecalc??
in my scripts i always come across this prob of converting julain date (CCYY DDD) to the MM DD YY format, so it would be a great help if i could use datecalc for the same purpose
Thank you very much for your prompt responses.
I got some solution in the net its working fine in my desktop(windows 2000) with cygwin, but its giving bailing error in my server(Sun OS 5.8).
Could any one of you help me to solve the problem, the code is below.
I wonder : Is there a way in a KSH shell what the yesterdays last business day is:
so for instance monday 03112008 (ddmmyyyy) should be give 31102008.
I've search this site but couldn't found something. Did also tried with Julians Day
I'm using AIX 5.2.0 with KSH shell pls give me a hand
but i got a problem with the
# ./yesterbusinessday
+ alias datecalc=./datecalc
+ echo Enter year month day
Enter year month day
+ read year month day
2008 11 3
+ ./datecalc -d 2008 11 3
./yesterbusinessday[7]: ./datecalc: not found.
+ (( == 1 ))
./yesterbusinessday[7]: == 1: 0403-057 Syntax error