English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have to display a number of days of the previous month in one of our page

2007-01-28 16:40:23 · 1 answers · asked by Brajendra 3 in Computers & Internet Programming & Design

1 answers

I don't know PHP, but I can give you some psuedo code that will do this:

function GetNumberOfDaysInMonth( intMonthNumber as integer) as integer

select case
1: return 31
2: return if(Mod(currentyear,4) = 0, 29, 28)
3: return 31
4: return 30
5: return 31
6: return 30
7: return 31
8: return 31
9: return 30
10: return 31
11: return 30
12: return 31
end function

function GetNumberOfDaysInLastMonth() as integer
return GetNumberOfDaysInMonth(if( currentmonth = 1, 12, currentmonth-1))
end function

2007-01-28 19:52:30 · answer #1 · answered by spencersoft 2 · 0 0

fedest.com, questions and answers