Displaying proper date format depending on culture

后端 未结 8 1331
感情败类
感情败类 2021-01-06 06:40

I am using a control for a popup calendar date picker. This uses a javascript function, SetText, to set the textbox to the given date. I can\'t change anything in the cale

8条回答
  •  醉酒成梦
    2021-01-06 07:09

    You are using the Microsoft Ajax Framework, this framework defines a set of "client-side type extensions" which provide added functions or "extensions" to the JavaScript base types.

    The Date Type Extensions is what you're looking for, specifically the Date.parseLocale function.

    With this function you can parse a string, using a given format.

    You can synchronize your server-side and client-side culture by setting the ScriptManager.EnableScriptGlobalization property to true, and use the Date.parseLocale function without specifying any format.

    Give a look to this article:

    • Walkthrough: Globalizing a Date by Using Client Script

提交回复
热议问题