Computing.Net > Forums > Unix > get day of the month

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

get day of the month

Reply to Message Icon

Name: sunilmyneedi
Date: November 23, 2006 at 02:29:10 Pacific
OS: unix
CPU/Ram: none
Product: none
Comment:

how to get the day(mon,tue...)of 1st of the given month



Sponsored Link
Ads by Google

Response Number 1
Name: Devaraj (by Fidy)
Date: November 23, 2006 at 04:07:28 Pacific
Reply:

try this dude..

#!/bin/ksh

set -A month_arr Sunday Monday Tuesday Wednesday Thursday Friday Saturday
day=`cal $1 $2 |head -3 | tail -1 | awk '{print NF}'`
#echo $day
num=` expr 7 - $day`
#echo $num
print ${month_arr[$num]}


run the script as: scriptname month year
eg - script 03 2006

cheers,
Devaraj

Regards,
Devaraj Takhellambam


0

Response Number 2
Name: nails
Date: November 23, 2006 at 13:15:19 Pacific
Reply:

Check out this link:

http://www.computing.net/unix/wwwbo...

It discusses how to find the day of week for a given date.


0

Response Number 3
Name: sunilmyneedi
Date: November 23, 2006 at 22:43:51 Pacific
Reply:

thanks alot...



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


pipeline output as variab... Combining files line by l...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: get day of the month

How to find week no. of the month? www.computing.net/answers/unix/how-to-find-week-no-of-the-month/5792.html

Find the day of week using AWK www.computing.net/answers/unix/find-the-day-of-week-using-awk/5243.html

crontab for last day of the every m www.computing.net/answers/unix/crontab-for-last-day-of-the-every-m/6661.html