Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
date type?
#17
(03-01-2023, 06:55 PM)TerryRitchie Wrote:
(03-01-2023, 06:31 PM)Kernelpanic Wrote:
Quote:Years might be tricky with leap years...

The determination of leap years could be inserted.
Code: (Select All)
'Bestimmung von Schaltjahren - 1. Maerz 2023

Option _Explicit

Dim As Integer jahr, jahrAktuell

'Aktuell Jahreszahl ermitteln und zuweisen
jahrAktuell = Val(Right$(Date$, 4))

Locate 2, 2
Print "Zeigt ob ein Jahr ein Schaltjahr ist"
Locate 3, 2
Print "===================================="

Locate 5, 2
Input "Geben Sie das Jahr ein: ", jahr

Locate 7, 2
If (jahr Mod 4 = 0 And jahr Mod 100 <> 0) Or (jahr Mod 4 = 0 And jahr Mod 100 = 0 And jahr Mod 400 = 0) Then
  If jahr < jahrAktuell Then
    'Was, is a leap year
    Beep: Print Using "#### war ein Schaltjahr!"; jahr
  Else
    Beep: Print Using "#### ist ein Schaltjahr!"; jahr
  End If
Else
  If jahr < jahrAktuell Then
    Print Using "#### war kein Schaltjahr!"; jahr
  Else
    Print Using "#### ist kein Schaltjahr!"; jahr
  End If
End If

End

Yes, as I recall many of the date functions run on a 400 and 100 year cycle such as leap years and the Easter calculation.

I think if the tricky stuff like this can be identified then the logic can be added to handle it. 

Heck, if we simply hardcode the leap years upto the next 200 years then we're good to go right? LoL

(Although we probably need to put in the info for past years as well, but it's doable.)

Just saying...
Reply


Messages In This Thread
date type? - by madscijr - 02-28-2023, 08:14 AM
RE: date type? - by mnrvovrfc - 02-28-2023, 09:21 AM
RE: date type? - by madscijr - 02-28-2023, 01:04 PM
RE: date type? - by mnrvovrfc - 02-28-2023, 02:22 PM
RE: date type? - by TerryRitchie - 02-28-2023, 07:50 PM
RE: date type? - by madscijr - 03-01-2023, 01:56 AM
RE: date type? - by mnrvovrfc - 03-01-2023, 03:37 AM
RE: date type? - by SMcNeill - 03-01-2023, 09:58 AM
RE: date type? - by bplus - 03-01-2023, 04:05 PM
RE: date type? - by madscijr - 03-01-2023, 05:29 PM
RE: date type? - by mnrvovrfc - 03-01-2023, 10:11 PM
RE: date type? - by SpriggsySpriggs - 03-01-2023, 02:40 PM
RE: date type? - by madscijr - 03-01-2023, 03:27 PM
RE: date type? - by mnrvovrfc - 03-01-2023, 04:16 PM
RE: date type? - by SpriggsySpriggs - 03-01-2023, 04:31 PM
RE: date type? - by Kernelpanic - 03-01-2023, 06:31 PM
RE: date type? - by TerryRitchie - 03-01-2023, 06:55 PM
RE: date type? - by madscijr - 03-01-2023, 09:18 PM
RE: date type? - by SMcNeill - 03-02-2023, 02:23 AM
RE: date type? - by bplus - 03-02-2023, 02:35 AM
RE: date type? - by madscijr - 03-02-2023, 06:48 PM



Users browsing this thread: 3 Guest(s)