German Tage zwischen zwei Datum

mcmanu

Active Member
Licensed User
Hallo,

Ich will die Tage, Stunden, Minuten und Sekunden zwischen zwei Datum ermitteln und anzeigen.
Die Anzeige Funktioniert klasse nur stimmt die Anzahl der Tage nicht wirklich.
Was habe ich Falsch gemacht?


B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
Dim timer1 As Timer
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
Dim periode1 As Period
    Private Label1 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("testlay")
timer1.Initialize("Timer1",1000)
timer1.Enabled=True
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub timer1_tick
DateTime.DateFormat="dd.MM.yyyy HH:mm:ss"
If DateTime.Now < DateTime.DateParse("10.06.2016 21:00:00") Then
periode1=DateUtils.PeriodBetween(DateTime.Now,DateTime.DateParse("10.06.2016 21:00:00"))
Label1.text=periode1.Days & " Tage " & periode1.Hours & " Stunden " & periode1.Minutes & " Minuten " & periode1.Seconds & " Sekunden"
Else
timer1.Enabled=False
End If
End Sub
 

mcmanu

Active Member
Licensed User
Hi,
Ah okay :) Danke für den Tipp ;)
Hat Super Funktioniert ;)
Dankeschön ;)
 
Last edited:
Top