You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia...@googlegroups.com
Folks, I am a Julia newcomer. I need to get current time. And now() works just fine. But it returns a local time. And I need GMT time.
I got to documentation. It gave me very nice description:
now() → DateTime
Returns a DateTime corresponding to the user’s system time including the system timezone locale.
now(::Type{UTC}) → DateTime
Returns a DateTime corresponding to the user’s system time as UTC/GMT.
I spent an hour and still couldn't figure out how to call the second method.
Jacob Quinn
unread,
May 4, 2015, 2:08:27 PM5/4/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia...@googlegroups.com
Yeah, the second one is a little obscure, because of a couple of issues.
-`UTC` isn't exported from the Dates module, so you'll have to use `Dates.UTC`
-`UTC` is a *type* instead of a instance of a type, (that's what the ::Type{UTC} means)
So the correct way to call this is
now(Dates.UTC)
Milan Bouchet-Valat
unread,
May 4, 2015, 2:09:06 PM5/4/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia...@googlegroups.com
Just like this:
julia> using Base.Dates
julia> now(UTC)
2015-05-04T18:07:16.464
If you think that's unclear, maybe you could make a pull request to
improve the documentation? Showing how to make the call could be useful.
Regards
Milan Bouchet-Valat
unread,
May 4, 2015, 3:32:45 PM5/4/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia...@googlegroups.com
Le lundi 04 mai 2015 à 20:09 +0200, Milan Bouchet-Valat a écrit :
> Le lundi 04 mai 2015 à 11:02 -0700, Irving Rabin a écrit :
> > Folks, I am a Julia newcomer. I need to get current time. And now()
> > works just fine. But it returns a local time. And I need GMT time.
> >
> > I got to documentation. It gave me very nice description:
> >
> >
> > now() → DateTime
> >
> > Returns a DateTime corresponding to the user’s system time
> > including the system timezone locale.
> >
> > now(::Type{UTC}) → DateTime
> >
> > Returns a DateTime corresponding to the user’s system time as
> > UTC/GMT.
> >
> > I spent an hour and still couldn't figure out how to call the second
> > method.
> Just like this:
> julia> using Base.Dates
>
> julia> now(UTC)
> 2015-05-04T18:07:16.464