If $dateDeadiline
is indeed defined, your should wrap it with strtotime()
.
On the manual
:
string date ( string $format [, int $timestamp = time() ] )
You should provide a timestamp
, not a string date. Consider this example:
<?php
$dateDeadiline = '2014-06-21 12:32:00';
?>
<input type="datetime" name="deadline" required value="<?php echo date('c', strtotime($dateDeadiline)); ?>" />
Using DateTime
Class with timezone:
<?php $date = new DateTime('2014-06-21 12:32:00', new DateTimeZone('America/New_York')); ?>
<input type="datetime" name="deadline" required value="<?php echo $date->format('c'); ?>" />
For list of supported timezones, you can check this link:
http://www.php.net//manual/en/timezones.php