How to test zero date-time in DB and display it in Nette
- ydenda
- Member | 21
Hello everyone,
I'd like to have time and date of last login stored in my DB. Default value
in DB for each user is
“0000–00–00 00:00:00”. After First login I want to inform user, he is
logged in first time. My point is, that representation of zero date and time in
DB differs from Nette, which says:
“-0001–11–30 00:00:00”
I expect some beginners fault. In DB is the date stored as timestamp.
Could you please give me a clue, how to successfully test zero date and time in Nette? (if the timestamp is not zero, I'd like to show time and date of last login.)
Should I use different way of date-time handling?
Thank you in advance,
Ydenda
- David Matějka
- Moderator | 6445
you should use null
in db instead of
0000–00–00 00:00:00
(unless you wanna store jesus christ birth
day :))
Last edited by matej21 (2014-09-01 22:20)