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

get day of the month

Reply to Message Icon

Original Message
Name: sunilmyneedi
Date: November 23, 2006 at 02:29:10 Pacific
Subject: get day of the month
OS: unix
CPU/Ram: none
Model/Manufacturer: none
Comment:

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


Report Offensive Message For Removal


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

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


Report Offensive Follow Up For Removal

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

Check out this link:

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

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


Report Offensive Follow Up For Removal

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

thanks alot...



Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: get day of the month

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge