Javascript 在 JQuery 中将日期转换为 dd/MM/yyyy 格式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3965365/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 06:53:16  来源:igfitidea点击:

Convert date into dd/MM/yyyy format in JQuery

javascriptjquerydatetime

提问by Red Swan

I am getting selected date as in Thu Oct 14 2010 00:00:00 GMT 0530 (India Standard Time)format. I want to convert this in dd/MM/yyyyformat. What have to do in jQuery?

我正在按Thu Oct 14 2010 00:00:00 GMT 0530 (India Standard Time)格式获取选定的日期。我想将其转换为dd/MM/yyyy格式。在 jQuery 中必须做什么?

回答by tsurahman

if you want more powerfull date formatting, you can use date format function written by Steven Levithanhere

如果你想要更强大的日期格式,你可以在这里使用Steven Levithan编写的日期格式函数

var date = dateFormat(new Date("Thu Oct 14 2010 00:00:00 GMT 0530 (India Standard Time)"), 'dd/mm/yyyy');