javascript client date format

牧云@^-^@ 提交于 2019-12-11 05:59:54

问题


I had a problem on extjs date. Seem by default it using computer date to create a date. I don't check up my pc and post the date.Then i found it based on American

 M/d/yyyy.

After i change the system regional setting date to d-m-Y.Everthing work fine. So anybody know how extjs get client date format ?

e.g 'YYYY-mm-dd' or 'M/d/yyyy' .

Since i need to parse the format from extjs code to php to mysql date format. I try to find stackoverflow and site but seem not found out,


回答1:


You can convert date to String when transfer it so that you can set the date format by yourself.




回答2:


Actually the default format used is 'm/d/y', and you can change the format self, and I don't think so the ext can get the client date format and change the format consistently.




回答3:


dont mind your regional setting

you have two options in your server you convert to string and change format

yourDate.ToString("MMM dd, yyyy")

see here or here for standard and custom format

or in your extjs code you use

renderer: Ext.util.Format.dateRenderer('d-M-Y'),

see here for available format strings.



来源:https://stackoverflow.com/questions/8722448/javascript-client-date-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!