Mathematica 中的 DateString 有问题
如果我输入
DateString[{2011, 2, 29, 0, 0, 0}, {"DayName"}]
它会给出 "Tuesday"
。
另外,
DateString[{2011, 2, 29, 0, 0, 0}, {"DayName"}]
DateString[{2011, 3, 1, 0, 0, 0} , {"DayName"}]
If I type
DateString[{2011, 2, 29, 0, 0, 0}, {"DayName"}]
It gives "Tuesday"
.
And also,
DateString[{2011, 2, 29, 0, 0, 0}, {"DayName"}]
DateString[{2011, 3, 1, 0, 0, 0}, {"DayName"}]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当然,如果您愿意,您可以抛出一条消息(或 Abort[] 或其他任何内容):
Of course you may throw a message (or Abort[], or whatever) if you want to :
在我看来,这像是正确的行为。
DateString
的文档说:“超出正常范围的 m、d、h、m、s 的值会适当减少。”这就是所发生的事情:今年并没有真正的 2 月 29 日,但如果有的话,那也是实际上的 3 月 1 日,这确实是星期二。This looks to me like correct behaviour. The documentation for
DateString
says: "Values of m, d, h, m, s outside their normal ranges are appropriately reduced." which is just what's happened: there isn't really a 29th of February this year, but if there were it would be the same day that's actually the 1st of March, which is indeed a Tuesday.