I am trying to format a datepicker to have a specific format. The format I am looking for is ISO 8601 yy-mm-dd. Something is wrong inside $(function), but I’m not sure what.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Datepicker - Format date</title>
<link rel="stylesheet" href="<?php echo $jquery_css?>" type="text/css" />
<script type="text/javascript" src="<?php echo $jquery?>"></script>
<script type="text/javascript" src="<?php echo $jquery_ui?>"></script>
<script type="text/javascript">
$(function() {
$.datepicker.formatDate('yy-mm-dd', "datepicker");
});
</script>
</head>
<body>
<div class="demo">
<p>Date: <input type="text" id="datepicker" size="30"/></p>
</div>
$("#datepicker").datepicker({dateFormat: 'yy-mm-dd'})is the syntax you want
http://docs.jquery.com/UI/Datepicker#option-dateFormat