Re: [go-nuts] time.Parse : hour out of range

2016-10-19 Thread Diego Medina
Thanks for the answers, looks like I'll keep using my work around for the 
time being.

Diego



On Wednesday, October 19, 2016 at 1:19:08 PM UTC-4, Kyle Shannon wrote:
>
> Related to: 
>
> https://github.com/golang/go/issues/12919 
>
> On Tue, Oct 18, 2016 at 9:49 PM, Diego Medina  > wrote: 
> > Hi, 
> > 
> > From a 3rd party I get a file with time like 1503  or 900 (meaning 
> 3:03PM or 
> > 9:00 AM) 
> > 
> > so I thought I could use this format: 
> > 
> > https://play.golang.org/p/RKR71hTWGo 
> > 
> > x, err := time.Parse("1504", "900") 
> > 
> > but the result is: 
> > 
> > 2009/11/10 23:00:00 parsing time "900": hour out of range 
> > 
> > As a work around I check if the time is only 3 char long and then I 
> prepend 
> > a 0, then parsing is ok. 
> > 
> > Is this the only way or am I missing anything? 
> > 
> > Thank you. 
> > 
> > Diego 
> > 
> > 
> > -- 
> > 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...@googlegroups.com . 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> Kyle 
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] time.Parse : hour out of range

2016-10-18 Thread Diego Medina
Hi,

>From a 3rd party I get a file with time like 1503  or 900 (meaning 3:03PM 
or 9:00 AM)

so I thought I could use this format:

https://play.golang.org/p/RKR71hTWGo

x, err := time.Parse("1504", "900")

but the result is:

2009/11/10 23:00:00 parsing time "900": hour out of range

As a work around I check if the time is only 3 char long and then I prepend 
a 0, then parsing is ok.

Is this the only way or am I missing anything?

Thank you.

Diego


-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.