For this format (assuming datepart has the format dd-mm-yyyy) in plain javascript use dateString2Date . [Edit] Added an ES6 utility method ... ... <看更多>
To create one from a custom string format, use DateTime.fromFormat. To create one from a native JS date, use DateTime.fromJSDate. Gregorian calendar and time: ... ... <看更多>
There is no need to use third party libraries. See the details from msdn. Use the pareseLocale function to create an object of type Date from a string. If you ... ... <看更多>