FAQ
Hey Guys,

I'm fairly new to Go and am currently having some trouble parsing a time
string of the format "YYYY-MM-DDTHH:MM:SS.SSSZ". This is the play that I'm
currently working on: http://play.golang.org/p/YUrnVw4PXZ. The time
strings I'm trying to parse don't have any characters after the "Z" but as
you can see in the Play I've tried adding a timezone offset to the layout
string and the string I want to parse(to no avail). The times I'm parsing
will always be in UTC and thus have no timezone information on them. At
first use the time.Parse is a bit odd, can someone point me in the right
direction on parsing the time from strings of this format?

Thanks!

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Jan Mercl at Dec 20, 2013 at 3:07 pm
    On Thu, Dec 19, 2013 at 5:47 PM, wrote:

    Did you mean http://play.golang.org/p/jj2UUf2cC7 ?

    -j

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Kevin Gillette at Dec 20, 2013 at 3:32 pm
    The time format you're describing is identical or very similar to
    time.RFC3339. http://play.golang.org/p/rMEn_xXngN

    You can generally expect most modern language standard libraries to have
    pre-existing support for this format.

    On Thursday, December 19, 2013 9:47:34 AM UTC-7, sco...@referabuyer.com
    wrote:
    Hey Guys,

    I'm fairly new to Go and am currently having some trouble parsing a time
    string of the format "YYYY-MM-DDTHH:MM:SS.SSSZ". This is the play that I'm
    currently working on: http://play.golang.org/p/YUrnVw4PXZ. The time
    strings I'm trying to parse don't have any characters after the "Z" but as
    you can see in the Play I've tried adding a timezone offset to the layout
    string and the string I want to parse(to no avail). The times I'm parsing
    will always be in UTC and thus have no timezone information on them. At
    first use the time.Parse is a bit odd, can someone point me in the right
    direction on parsing the time from strings of this format?

    Thanks!
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Scottm at Dec 20, 2013 at 3:35 pm
    Thanks for the help! And sorry for the question that is pretty silly in
    retrospect-- I thought that RFC3339 would *surely* fail because the lack of
    miliseconds, and RFC3339Nano would *surely* fail because of having too much
    precision. That'll teach me to make assumptions...
    On Friday, December 20, 2013 10:32:25 AM UTC-5, Kevin Gillette wrote:

    The time format you're describing is identical or very similar to
    time.RFC3339. http://play.golang.org/p/rMEn_xXngN

    You can generally expect most modern language standard libraries to have
    pre-existing support for this format.

    On Thursday, December 19, 2013 9:47:34 AM UTC-7, sco...@referabuyer.comwrote:
    Hey Guys,

    I'm fairly new to Go and am currently having some trouble parsing a time
    string of the format "YYYY-MM-DDTHH:MM:SS.SSSZ". This is the play that I'm
    currently working on: http://play.golang.org/p/YUrnVw4PXZ. The time
    strings I'm trying to parse don't have any characters after the "Z" but as
    you can see in the Play I've tried adding a timezone offset to the layout
    string and the string I want to parse(to no avail). The times I'm parsing
    will always be in UTC and thus have no timezone information on them. At
    first use the time.Parse is a bit odd, can someone point me in the right
    direction on parsing the time from strings of this format?

    Thanks!
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 20, '13 at 1:20p
activeDec 20, '13 at 3:35p
posts4
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase