如何将DateTime转换为另一种格式? [英] How do I convert DateTime to another format?
本文介绍了如何将DateTime转换为另一种格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从天气馈送中以 2012-05-17
的形式获取日期数据。
From a weather feed I'm getting the data for dates in the form of 2012-05-17
.
如何将其转换为 5月17日星期四
表格?
推荐答案
- Parse the string into a JavaScript
Date
object. - Format the Date object however you like.
另请参见:为什么Date.parse给出不正确的结果?和如何格式化JavaScript日期问题。
See also: Why does Date.parse give incorrect results? and How to format a JavaScript date questions.
这篇关于如何将DateTime转换为另一种格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文