使用自定义格式的JavaScript字符串 [英] javascript string to date using custom format

查看:89
本文介绍了使用自定义格式的JavaScript字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个字符串 10/11/2012 意味着2012年11月10日。

I have a string 10/11/2012 meaning November 10, 2012.

但是当我做新日期(10/11/2012)它将返回10月11日。

But when I do new Date("10/11/2012") it returns October 11th.

如何传递我想要的日期格式?在这种情况下 dd-mm-yyyy

How do I pass in the date format I want? In this case dd-mm-yyyy

推荐答案

我发现了jQuery。 datepicker.parseDate(format,Date)在此站点:

I found jQuery.datepicker.parseDate(format, Date) at this site:

http://docs.jquery.com/UI/Datepicker/ $ .datepicker.parseDate

http://docs.jquery.com/UI/Datepicker/$.datepicker.parseDate

所以我将使用jQuery datepicker 。

So I will be using the jQuery datepicker instead.

这篇关于使用自定义格式的JavaScript字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆