使用javascript正则表达式从日期字符串中检索年份 [英] Using javascript regex to retrieve year from date string
本文介绍了使用javascript正则表达式从日期字符串中检索年份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须从日期字符串中检索年份.日期字符串格式应为以下任何格式.我需要全球化代码才能以任何日期字符串格式检索年份.
I have to retrieve the year from date string. the date string format should be any of the following formats. I need to globalized code to retrieve the year in any date string formats.
日期格式,"30/8/2013","08/30/2013","30-8-2013","2013-08-30","30.8.2013","30-08-13" ,"13-08-30"等.
Date formats, "30/8/2013","08/30/2013",30-8-2013","2013-08-30","30.8.2013","30-08-13","13-08-30" etc.
推荐答案
看看这个库. http://momentjs.com/
这可能是您最好的选择.
This is probably your best option available.
这篇关于使用javascript正则表达式从日期字符串中检索年份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文