note 43910 deleted from function.date by tomsommer

From: Date: Sat, 17 Jul 2004 13:18:36 +0000
Subject: note 43910 deleted from function.date by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-73440@lists.php.net to get a copy of this message
Note Submitter: m.veen@roc-nijmegen.nl ---- Beware! If you use a variable that contains a timestamp (for instance when retrieving values from a database), then watch out for empty values. An empty value will be displayed as the first possible date. For example: $my_timestamp=NULL; $my_date=date("d-m-Y", $my_timestamp); Then: echo($my_date); Will display ' 01-01-1970 '. The if-statement to prevent this is very straightforward, but you have to be aware of the fact that date("format", timestamp) will always try to return something. Even for a NULL value or a "" value. Only when you try to use negative integers as timestamp will a warning be generated.

« previous php.notes (#73440) next »