Autor |
Beitrag |
Marco D.
![Marco D. hat insgesamt 79.2% On-Topic und 20.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Marco D. hat insgesamt 79.2% On-Topic und 20.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Marco D. hat insgesamt 79.2% On-Topic und 20.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Marco D. hat insgesamt 79.2% On-Topic und 20.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Marco D. hat insgesamt 79.2% On-Topic und 20.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Marco D. hat insgesamt 79.2% On-Topic und 20.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Marco D. hat insgesamt 79.2% On-Topic und 20.8% Off-Topic Beiträge geschrieben. half ontopic star](./graphics/ranks/star_onofftopic.png)
Beiträge: 2750
Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
|
Verfasst: Di 31.07.07 14:59
Ich möchte den UNIX-Timestamp der ersten Sekunde eines bestimmten Tages herausfinden.
Hintergrund:
Ich entwickle einen Eventlogger. Beim Abspeichern eines Events wird die aktuelle Zeit als Timestamp in der DB hinterlegt. Nun möchte ich anhand eines Datums alle Events auflisten lassen, die genau an diesem Tag passiert sind. Also muss der Timestamp eines Events, dass in Frage kommt, größer als die erste Sekunde des Tages und kleiner als die nächste Sekunde das folgenden Tages sein. Ist das richtig?
Zum Umwandeln eines Timestamps in ein Datum verwende ich:
C#-Quelltext 1: 2: 3: 4:
| public function ListByDate($date) { $stamp = strtotime($date); ... } |
Und wie erhöhe ich $date um 1, also wie gehe ich zum nächsten Tag?
Das Datumsformat wird dd.mm.yyyy sein.
_________________ Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
|
|
ene
![ene hat insgesamt 62.3% On-Topic und 37.7% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![ene hat insgesamt 62.3% On-Topic und 37.7% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![ene hat insgesamt 62.3% On-Topic und 37.7% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![ene hat insgesamt 62.3% On-Topic und 37.7% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![ene hat insgesamt 62.3% On-Topic und 37.7% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![ene hat insgesamt 62.3% On-Topic und 37.7% Off-Topic Beiträge geschrieben. offtopic star](./graphics/ranks/star_offtopic_full.png) ![ene hat insgesamt 62.3% On-Topic und 37.7% Off-Topic Beiträge geschrieben. offtopic star](./graphics/ranks/star_offtopic_full.png)
Beiträge: 779
Erhaltene Danke: 1
Vista, XP, W2K
Delphi, .Net, Deutsch und Englisch
|
Verfasst: Di 31.07.07 15:02
Hi,
reicht es nicht einfach den entsprechenden Tag abzufragen? Denn 24:00 gibt es nicht und bei 23:59:59 ist der Tag zu ende.
_________________ Wir, die guten Willens sind, geführt von Ahnungslosen, Versuchen für die Undankbaren das Unmögliche zu vollbringen.
Wir haben soviel mit so wenig so lange versucht, daß wir jetzt qualifiziert sind, fast alles mit Nichts zu bewerkstelligen.
|
|
GTA-Place
![GTA-Place hat insgesamt 74.5% On-Topic und 25.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![GTA-Place hat insgesamt 74.5% On-Topic und 25.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![GTA-Place hat insgesamt 74.5% On-Topic und 25.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![GTA-Place hat insgesamt 74.5% On-Topic und 25.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![GTA-Place hat insgesamt 74.5% On-Topic und 25.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![GTA-Place hat insgesamt 74.5% On-Topic und 25.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![GTA-Place hat insgesamt 74.5% On-Topic und 25.5% Off-Topic Beiträge geschrieben. offtopic star](./graphics/ranks/star_offtopic_full.png)
![EE-Regisseur EE-Regisseur](graphics/ranks/regisseur.png)
Beiträge: 5248
Erhaltene Danke: 2
WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
|
Verfasst: Di 31.07.07 15:22
Datum in Timestamp: mktime();
Timestap zu Datum: date();
_________________ "Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
|
|
BenBE
![BenBE hat insgesamt 82.2% On-Topic und 17.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![BenBE hat insgesamt 82.2% On-Topic und 17.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![BenBE hat insgesamt 82.2% On-Topic und 17.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![BenBE hat insgesamt 82.2% On-Topic und 17.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![BenBE hat insgesamt 82.2% On-Topic und 17.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![BenBE hat insgesamt 82.2% On-Topic und 17.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![BenBE hat insgesamt 82.2% On-Topic und 17.8% Off-Topic Beiträge geschrieben. half ontopic star](./graphics/ranks/star_onofftopic.png)
Beiträge: 8721
Erhaltene Danke: 191
Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
|
Verfasst: Di 31.07.07 20:08
Typische Anwendung für mktime:
1. Abzufragendes Datum getrennt in Tag, Monat und Jahr angeben und an mktime übergeben
2. Zum Datum 86400 addieren
3. Filtern nach Start <= Datum < Ende
_________________ Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
|
|
Arne K.
![Arne K. hat insgesamt 60.5% On-Topic und 39.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Arne K. hat insgesamt 60.5% On-Topic und 39.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Arne K. hat insgesamt 60.5% On-Topic und 39.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Arne K. hat insgesamt 60.5% On-Topic und 39.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Arne K. hat insgesamt 60.5% On-Topic und 39.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Arne K. hat insgesamt 60.5% On-Topic und 39.5% Off-Topic Beiträge geschrieben. offtopic star](./graphics/ranks/star_offtopic_full.png) ![Arne K. hat insgesamt 60.5% On-Topic und 39.5% Off-Topic Beiträge geschrieben. offtopic star](./graphics/ranks/star_offtopic_full.png)
![EE-Autor EE-Autor](graphics/ranks/autor.png)
Beiträge: 112
C# (VS 2008 Professional)
|
Verfasst: Di 31.07.07 22:05
Ganz ehrlich? Ich würde mir das Theater mit den Timestamps sparen:
Quelltext 1: 2: 3:
| if(date('dmY') === date('dmY', $timestamp)) { // Whatsoever } |
|
|
BenBE
![BenBE hat insgesamt 82.2% On-Topic und 17.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![BenBE hat insgesamt 82.2% On-Topic und 17.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![BenBE hat insgesamt 82.2% On-Topic und 17.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![BenBE hat insgesamt 82.2% On-Topic und 17.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![BenBE hat insgesamt 82.2% On-Topic und 17.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![BenBE hat insgesamt 82.2% On-Topic und 17.8% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![BenBE hat insgesamt 82.2% On-Topic und 17.8% Off-Topic Beiträge geschrieben. half ontopic star](./graphics/ranks/star_onofftopic.png)
Beiträge: 8721
Erhaltene Danke: 191
Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
|
Verfasst: Mi 01.08.07 09:56
Nur schade, dass die meisten DBs date nicht direkt unterstützen für Timestamps ![;-)](images/smiles/icon_wink.gif) Von daher ist es normales Vorgehen, das über die Timestamps zu machen. die von der DB unterstützen Datum-\Zeit-Funktionen sind zwar gut und schön, wenn man aber nur filtern muss, sind numerische Abfragen nach den Unix-Timestamps schneller.
_________________ Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
|
|
Arne K.
![Arne K. hat insgesamt 60.5% On-Topic und 39.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Arne K. hat insgesamt 60.5% On-Topic und 39.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Arne K. hat insgesamt 60.5% On-Topic und 39.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Arne K. hat insgesamt 60.5% On-Topic und 39.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Arne K. hat insgesamt 60.5% On-Topic und 39.5% Off-Topic Beiträge geschrieben. ontopic star](./graphics/ranks/star_ontopic_full.png) ![Arne K. hat insgesamt 60.5% On-Topic und 39.5% Off-Topic Beiträge geschrieben. offtopic star](./graphics/ranks/star_offtopic_full.png) ![Arne K. hat insgesamt 60.5% On-Topic und 39.5% Off-Topic Beiträge geschrieben. offtopic star](./graphics/ranks/star_offtopic_full.png)
![EE-Autor EE-Autor](graphics/ranks/autor.png)
Beiträge: 112
C# (VS 2008 Professional)
|
Verfasst: Mi 01.08.07 14:01
Sicher, aber man erspart sich das rumrechnen und der Code wird (meiner Meinung nach) übersichtlicher.
Und ich denke, PHP hat ganz andere Geschwindigkeitslecks, als dass eine Umformung zweier Timestamps ins Gewicht fallen würden ![;)](images/smiles/icon_wink.gif)
|
|
|