jQuery UI Widgets › Forums › Editors › DateTimeInput › Wrong Date getting on jqxDateTimeInput
Tagged: date, datetimeinput, format, formatString, jqxdatetimeinput, string, value
This topic contains 6 replies, has 2 voices, and was last updated by Dimitar 10 years, 2 months ago.
-
Author
-
Hello,
We are using below like jqxDateTimeInput.But we are getting wrong date on jqxDateTimeInput.
` $(“#date_stamp”).jqxDateTimeInput({width: 200, height: 25, formatString: “dd/MM/yyyy”, theme: theme,value:’09/07/2014′});’
and result like
input jqxDateTimeInput :09/07/2014
Output jqxDateTimeInput :07/09/2014Could you please help us ??
Thanks,
AlpeshHello Alpesh,
The formatString property controls how the date is displayed but value does not conform to it; value should be either a date object or a dateString. The dateString “09/07/2014” means September 7, 2014 which is then formatted to “07/09/2014”. I hope that makes things clear.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/thanks for reply
We need ’09/07/2014′ means July 9,2014 in jqxDateTimeInput.
So how we can set it? we need to change format ??Thank
Alpeshalso we have set formatted string like this formatString: “dd/MM/yyyy”.
How we can set date like formatString ??Thanks
AlpeshHi Alpesh,
As I stated, these properties are not connected. The value should be set as a JavaScript Date object or a dateString. For example:
value: new Date("July 9, 2014")
or
value: new Date("07/09/2014")
or
value: new Date(2014, 6, 9)
or
value: "07/09/2014"
You can read more about the Date object here: http://www.w3schools.com/jsref/jsref_obj_date.asp.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Thanks for reply.
Could you please check below code ?$("#jqxDateTimeInput").jqxDateTimeInput({ width: '250px', height: '25px', theme: 'energyblue', formatString: "dd/MM/yyyy" }); var da=new Date('09/07/2014'); $("#jqxDateTimeInput").val(da);
We have set formatstring ‘dd/MM/yyyy’.Why we get wrong date ??
Thanks,
AlpeshHi Alpesh,
As I said, for July 9, 2014, your Date object should be initialized as:
new Date("07/09/2014")
and not:
new Date('09/07/2014')
To learn how to use the JavasCript Date object, look at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.