March 16, 2012
Jquery datepicker date format
Question by Dale
How do I get my date to display like this: “yy-mm-dd” inside my date input textbox after I have selected a date?
Information is reading from a database.
So I need it saved in a database again.
JavaScript:
<script>
$(document).ready(function() {
$("#from").datepicker();
});
</script>
Html code:
<div class="field">
<label>Date</label>
<input type="text" name="date" value="<?php value('date'); ?>" id="from" />
<?php if(isset($errors['date'])) { ?>
<div class="error"><?php echo $errors['date']; ?></div>
<?php } ?>
</div>
Things that I have tried:
http://docs.jquery.com/UI/Datepicker#option-dateFormat
http://docs.jquery.com/UI/Datepicker/formatDate