Autor Beitrag
JayK
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1013



BeitragVerfasst: So 13.11.05 21:34 
Hi,
ich möchte die Differenz des heutigen Tages (DateTime.Today) und eines in einem DateTimePicker eingegebenen Datums als Int Wert erhalten.
Mit Convert.ToInt64((System.DateTime.Today - DateTimePicker1.Value)) geht das aber nicht da man TimeSpan so nicht umwandeln kann :(
Was muss ich stattdessen machen?

Grüße
JayK
Robert_G
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 416


Delphi32 (D2005 PE); Chrome/C# (VS2003 E/A, VS2005)
BeitragVerfasst: So 13.11.05 21:52 
Ich denke mal, du benutzt die C# Express, right?
Schaue dir mal die Deklaration von TimeSpan an.
Im Code, goto definition -> ergeneriert stubs, die dir zeigen was der Typ alles macht
Du öffnest den Boject browser oder besser den Reflector.

Denn eigentlich hätte dir TimeSpan.TotalMilliseconds oder TimeSpan.Ticks auffallen müssen. ;)
ausblenden C#-Quelltext
1:
long miep = (date1 - date2).Ticks;					
JayK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1013



BeitragVerfasst: Mo 14.11.05 15:26 
Danke, klappt :D