SUMMARY: KSH day of week script in past

From: mtb 247 <mtb247_at_hotmail.com>
Date: Wed Jul 13 2005 - 15:27:18 EDT
The answer was to use gnu date like so:

#DAY=`/usr/local/bin/date -d 07/11/05 +%a`
# echo $DAY
Mon




also someone was nice enuf to give me this ksh function:

dow() { # year month day
	week=`cal "${2}" "${1}" | grep -w "${3}"`
	sun=`echo "${week}" | cut -c 01-02`
	mon=`echo "${week}" | cut -c 04-05`
	tue=`echo "${week}" | cut -c 07-08`
	wed=`echo "${week}" | cut -c 10-11`
	thu=`echo "${week}" | cut -c 13-14`
	fri=`echo "${week}" | cut -c 16-17`
	sat=`echo "${week}" | cut -c 19-20`
	if [ "${3}" -eq "${sun}" ]; then echo Sun; fi
	if [ "${3}" -eq "${mon}" ]; then echo Mon; fi
	if [ "${3}" -eq "${tue}" ]; then echo Tue; fi
	if [ "${3}" -eq "${wed}" ]; then echo Wed; fi
	if [ "${3}" -eq "${thu}" ]; then echo Thu; fi
	if [ "${3}" -eq "${fri}" ]; then echo Fri; fi
	if [ "${3}" -eq "${sat}" ]; then echo Sat; fi
}

dow 2004 12 31

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee. 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Wed Jul 13 15:27:40 2005

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:49 EST