![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Code Samples & Tips Share your recent discoveries and ideas with other users. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Leap year detection is quite simple ... every year divisible by 4 unless divisible by 100 except years divisible by 400. But Basic4PPC has a "built in"
leap year detection:Code:
Sub Globals
End Sub
Sub App_Start
Form1.Show
msgbox("2005: " & leapyear(2005))
msgbox("2004: " & leapyear(2004))
End Sub
sub leapyear(year)
' please keep correct Dateformat() in mind ...
if DateParse("02/29/" & year) = 0 then return False else return True
end sub
Thanks, Erel!
__________________
iPAQ 6515, MDA compact |
|
|||
|
Thanks RandomCoder,
indeed I wrote this tip with a big smile in my face ... ![]() And here is a more "classic" leap year detection. Works with year represented by number or by datetick: Code:
sub DateIsLeapYear(year) ' transform DateTick to year if necessary if year > 10000 then year = DateYear(year) ' calculate leap year if (year mod 4 = 0) and (year mod 100 <> 0) or (year mod 400) = 0 then return true else return false end sub
__________________
iPAQ 6515, MDA compact |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Drive Detection | RandomCoder | Questions & Help Needed | 9 | 07-04-2008 12:59 PM |
| Calendar Control: I can't see the year. | sloopa | Questions & Help Needed | 4 | 06-25-2008 07:30 PM |
| New Year, New Competition... | Cableguy | Forum Discussion | 2 | 01-08-2008 11:21 PM |
| New Year! | Tanner | Chit Chat | 16 | 01-03-2008 07:16 PM |