ERLEDIGT
NEIN
NEIN
ANTWORTEN
4
4
ZUGRIFFE
16199
16199
EMPFEHLEN
-
Ich brauche Timestamp in Sekunden seit Unix 1970!
Wie bekomme ich das in C# hin
-
02.06.05 12:23 #2
- Registriert seit
- Aug 2001
- Ort
- Österreich, Stmk, Graz
- Beiträge
- 2.783
Hallo
Code :1 2 3
TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); int timestamp = (int) t.TotalSeconds; Console.WriteLine (timestamp);
MfG,
AlexWith the first link the chain is forged. The first speech censored, the first thought forbidden, the first freedom denied, chains us all irrevocably.
Aaron Satie
Legends... are the spice of the universe, Mr. Data, because they have a way of sometimes coming true.
Captain Jean-Luc Picard, Stardate ~41294.5
Tutorials.de chattet. Hier gibts auch .net Support ^^
Klickt auf chattet und nutzt den Webchat, oder verbindet euch zu irc.tutorials.de - Channel #Tutorials.de
(moo)blog furred.net // SiteInfo für WP7 // Pastebin für WP7 // BlogEngine.net Extensions
-
Und wie bekomme ich aus dem Int Datumformat zurück!
Rückwandelung praktisch!
-
02.06.05 12:34 #4
- Registriert seit
- Aug 2001
- Ort
- Österreich, Stmk, Graz
- Beiträge
- 2.783
Sei kreativ, ist nicht schwer.

Code :1 2
System.DateTime dt= new System.DateTime(1970, 1, 1, 0, 0, 0, 0); dt= dt.AddSeconds(1113211532); // timestamp addieren..
With the first link the chain is forged. The first speech censored, the first thought forbidden, the first freedom denied, chains us all irrevocably.
Aaron Satie
Legends... are the spice of the universe, Mr. Data, because they have a way of sometimes coming true.
Captain Jean-Luc Picard, Stardate ~41294.5
Tutorials.de chattet. Hier gibts auch .net Support ^^
Klickt auf chattet und nutzt den Webchat, oder verbindet euch zu irc.tutorials.de - Channel #Tutorials.de
(moo)blog furred.net // SiteInfo für WP7 // Pastebin für WP7 // BlogEngine.net Extensions
-
Hallo Leute,
ich hatte ein paar Probleme mit der UTC und der Local-Time (Sommerzeit und Zeitzonen).
Deshalb habe ich den Code so erweitert:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13
Function GetDateTimeFromTimestamp(ByVal seconds As Long) As DateTime Dim myDt As DateTime myDt = New System.DateTime(1970, 1, 1, 0, 0, 0, 0) Dim t As TimeSpan = (DateTime.UtcNow - DateTime.Now) ' Differenz UTC zu Lokaler Zeit Dim timestamp As Long = t.TotalSeconds myDt = myDt.AddSeconds(seconds - timestamp) ' timestamp addieren.. Return myDt End Function
nun bekomme ich aus einem lokalem Timestamp eine korrekte DateTime (UTC) zurück.
Der Code ist noch nicht vollständig getestet und soll als Anregung verstanden werden.
Gruß
Raabun
Ähnliche Themen
-
Oracle timestamp to unix timestamp konvertieren
Von tplanitz im Forum Relationale DatenbanksystemeAntworten: 1Letzter Beitrag: 22.04.08, 09:36 -
Oracle 9.2i unix timestamp sekunden in datum umrechnen
Von tplanitz im Forum Relationale DatenbanksystemeAntworten: 2Letzter Beitrag: 06.09.06, 07:22 -
Timestamp _vor_ 1970
Von diggity im Forum PHPAntworten: 2Letzter Beitrag: 08.10.05, 01:08 -
Unterscheid zwischen einem Timestamp und dem aktuellen Timestamp in Minuten, Sekunden
Von CrushLog im Forum PHPAntworten: 11Letzter Beitrag: 04.10.04, 23:55 -
Timestamp VOR 1970
Von DoRiMaN im Forum PHPAntworten: 6Letzter Beitrag: 16.03.04, 13:48





Zitieren

Login





