Jump to content

[SOLVED] datepicker uses wrong date format

Recommended Posts

Found it!


Here is the original HTML line with no dateFormat:


Here's the same line with a dateFormat specified (note that "yy" means "four-digit year", not "two-digit year" in this context):

<script>$(document).ready(function(){$('.customDatePicker').datepicker({dateFormat: "yy-mm-dd"});});</script>

Original post follows:



I have this in php:


And this in HTML:

Delivery Date: <input type="text" name="delivery_date" label="Delivery Date" class="customDatePicker" id="delivery_date" value="'.date('Y-m-d').'">

And it works, EXCEPT the datepicker fills out the form field with the date in dd/mm/yyyy format.  This breaks my postProcess, which expects to get the date in yyyy-mm-dd


If I look in js/date.js I find:

//Date.format = 'dd/mm/yyyy';
//Date.format = 'mm/dd/yyyy';
Date.format = 'yyyy-mm-dd';
//Date.format = 'dd mmm yy';

So that's not the problem. 

In my Dashboard, the date range controls display in yyyy-mm-dd

In Orders, the date range pickers display in dd/mm/yyyy


I could work around it in postProcess, of course.  But I'd prefer employees to see the date in yyyy-mm-dd. 


How to control this date format?  Thanks in advance!

Edited by JuanTomas (see edit history)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More