Question

How do you change date format in date box? there are lots of different examples, none seem to work for me. Here is working JSFiddle of popup but I need date format like 11/07/2013.

Tried: "dateFormat":"%m/%d/%Y" and "overrideDateFormat":"%m/%d/%Y"

<div data-role="page" id="page1">
<div data-role="header">
     <h1>My page</h1> 
    <a  data-role="button" id="myplus" class="ui-btn-right" >+</a>
    <input name="mydate" id="mydate" type="date" data-role="datebox" data-options='{"mode": "calbox", "hideInput": "true", "centerHoriz": "true", "closeCallback":"onCLoseMyDate();"}' />
</div>

<div data-role="content">

</div>

Working Fiddle not correct format

Was it helpful?

Solution

Found at http://dev.jtsage.com/jQM-DateBox2/demos/api/events.html, under "Public Functions"

$('element').datebox('callFormat', <format> <date>)

As applied to your [updated] fiddle:

var dateObject = $('#mydate').datebox('getTheDate'),
    theDate =  $('#mydate').datebox('callFormat', '%m/%d/%Y', dateObject);
alert(theDate);   
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top