jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Problem with grid and datetimeinput
Tagged: grid date formatting
This topic contains 4 replies, has 2 voices, and was last updated by Peter Stoev 10 years, 8 months ago.
-
Author
-
Hi,
I tried to store and load a grid but i have some problems with variable date.
First I create a line and a date variable like this
Into IE, no problem th date is correct
[URL=http://www.casimages.com/i/140912035358430654.jpg][IMG]http://nsa33.casimages.com/img/2014/09/12/mini_140912035358430654.jpg[/IMG][/URL]
Afert I backup my data in a database, I can see that the date is changed like this (Fri Sep 19 00:00:00 UTC 0200 2014), is there a possibility to recorded date in the same format as in IE 8 client (.d => m/dd/yyyy)
[URL=http://www.casimages.com/i/140912035358761422.jpg][IMG]http://nsa34.casimages.com/img/2014/09/12/mini_140912035358761422.jpg[/IMG][/URL]
But when I reload my webpage (F5), we can see that the format is not the same like the picture 2 , why ?
[URL=http://www.casimages.com/i/140912035359287308.jpg][IMG]http://nsa34.casimages.com/img/2014/09/12/mini_140912035359287308.jpg[/IMG][/URL]
And if i want to change this cell….there is a problem with the datepicker like you could see on the two screen below
[URL=http://www.casimages.com/i/140912035359592052.jpg][IMG]http://nsa34.casimages.com/img/2014/09/12/mini_140912035359592052.jpg[/IMG][/URL]
[URL=http://www.casimages.com/i/140912035357783787.jpg][IMG]http://nsa34.casimages.com/img/2014/09/12/mini_140912035357783787.jpg[/IMG][/URL]Can you help me ?
is there a possibility to store data with the same format m/dd/yyyy
or
is there a possibility to display the data like m/dd/yyyy when the web page is refrehmy code for information
var source = { datatype: "json", datafields: [ { name: 'DTECRE', type: 'date' },
……..
columns: [ { text: 'DATE', datafield: 'DTECRE', width: 65, editable: true , columntype: 'datetimeinput' , cellsformat: 'd' },
Here the good link :
Into IE, no problem the date is correct
Afer I backup my data in a database, I can see that the date is changed like this (Fri Sep 19 00:00:00 UTC 0200 2014), is there a possibility to recorded date in the same format as in IE 8 client (.d => m/dd/yyyy)
But when I reload my webpage (F5), we can see that the format is not the same like the picture 2 , why ?
And if i want to change this cell….there is a problem with the datepicker like you could see on the two screen below
THANKS
Hi nico86,
jqxGrid works with JavaScript Date Object for Dates. You can learn from this page: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date how to Parse the Javascript Date object to a format of your choice or how to extract the different parts from it using its API.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ok
when I click my save Button, I transform my dates into my javascript file before recorded data like this
…. dateA=row.Date;
dateB= (dateA.getMonth()+1)+”/”+dateA.getDate()+”/”+dateA.getFullYear();but does it means that jqwidget can record the dates in a format but it can not read the same format when I import data ?
Thanks
…and sorry for my English, i hope you understand me.Hi nico86,
jqxGrid reads your String data during the data binding process and parses your Strings to JavaScript Date objects. Then depending on your cellsformat it formats the Date to something which you want to see as Date expression in your Grid. However, your Dates are always stored as JavaScript Date objects. You can parse a JavaScript Date object quickly and easy through the jqxDataAdapter’s formatDate method: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdataadapter/formatting.htm?arctic
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.