it’s amzing when i send a null value in date() as a second parameter then it returns some time? how to remove this thing. i want that if a string is null or empty then doesn’t do anything
$x=strtotime();
var_dump($x);
var_dump($x==NULL);
echo date('H:i',$x);
display
Warning: strtotime() expects at least 1 parameter, 0 given in
D:\xampp\htdocs\test\index.php on line 1
bool(false) bool(true) 05:30
It makes perfect sense. NULL equals
0in this case.date()counts from 0, which was January 1st, 1970, 0:00:00 UTC.You are based in Jaipur. Your timezone is UTC + 5:30 hours. Thus,
date(0)on your server, in your time zone, will result in January 1st, 1970, 5:30.