Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Datum auf Gültigkeit überprüfen

Empfohlene Antworten

Veröffentlicht

Hi wir stehen vor folgendem Problem: Wir haben ein Formular in das Benutzer ein Datum eintragen müssen. Wie prüfe ich mit VB Script ab, ob das Datum tatsächlich vorhanden ist (Datum liegt in der Zukunft)...Also dass z.B. soetwas wie der 30.02.2007 ausgefiltert wird und eine Meldung erscheint, doch bitte ein gültiges Datum einzugeben.

Danke & Gruß

VBS oder VB?

mit VB ginge es mit der nativen funktion IsDate, z.b. so:

Public Function isDateExt(strDate As String, Fmt As String) As Boolean

    If IsDate(strDate) Then

    isDateExt = (strDate = Format$(strDate, Fmt))

    End If

End Function


Dim strFmt as String

strFmt = "dd.mm.yyyy"


if IsDateExt("23.09.2001", strFmt ) then

    MsgBox "Datum OK"

else

    MsgBox "Datum bitte nur im Format '"& strFmt & "'"

end if

s'Amstel

Mir ging es nicht um das Datumsformat (dd.mm.yyyy oder mm.dd.yy) sondern darum, dass nicht existierende Tage wie der 30.02. oder der 31.09 usw. verboten werden...ich verstehe deine Funktion so, dass nur das Format geprüft wird.

mein beispiel berücksichtigt zusätzlich auch noch, ob das datum dem format entspricht. IsDate berücksichtig schon von haus aus, ob das datum ein gültiges kalenderdatum ist.

wenn du folgende ausdrücke evaluierst, wirst du sehen, dass es trotzdem klappt:

?IsDate("31.12.2005")

Wahr 'ist also ein gültiges datum

?IsDate("32.12.2005")

Falsch 'klar, denn am 32. dezember ist es zu spät

s'Amstel

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.