rusly
rusly

Reputation: 1524

Convert mysql date value to html5 date

Below is how i echo date using normal php date :

<input type="date" name="ref_date" value="<?php echo date('d-m-Y',strtotime($stock['ref_date']))?>">

and the value(date) is : 23-11-2012

but when i try to implement HTML5 date using :

<script type="text/javascript" src="js/jquery.tools.js"></script>
<script>
var $date = jQuery.noConflict();
$date(":date").dateinput({format: 'dd-mm-yyyy'});
</script>

why the value is different : 04-05-1929

Upvotes: 0

Views: 1761

Answers (1)

rusly
rusly

Reputation: 1524

just change the date format from

<?php echo date('d-m-Y',strtotime($stock['ref_date']))?>

to

<?php echo date('Y-m-d',strtotime($stock['ref_date']))?>

Upvotes: 3

Related Questions