如何在 Julia 中约会 [英] How to get date in Julia

查看:19
本文介绍了如何在 Julia 中约会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了文档,但找不到获取今天日期的函数.我可能遗漏了一些相当明显的东西.

I search the docs but I cannot find a function to get today's date.I probably am missing something fairly obvious.

我只需要类似的东西

julia> today()
2014-06-25

julia> string(today())
"2014-06-25"

推荐答案

您的精确草图现在可以完全按照您在使用日期之后编写的那样工作.Dates 模块是标准库的一部分,并且因此默认情况下可用:

Your exact sketch now works precisely as you've written it after using Dates. The Dates module is a part of the standard library and thus is available by default:

julia> using Dates

julia> today()
2020-08-20

julia> string(today())
"2020-08-20"

(注意:此答案已针对 1.0+ 版本进行了编辑和更新;此问题早于 Dates 标准库的存在.)

(note: this answer has been edited and updated for version 1.0+; this question pre-dates the existence of the Dates stdlib.)

这篇关于如何在 Julia 中约会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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