Or you could change the : to a . and use time.Parse.

-rob


On Tue, Oct 31, 2017 at 4:47 AM, Jim Cote <jfcot...@gmail.com> wrote:

> See https://golang.org/src/time/format.go?s=23626:23672#L249.  The
> standard library is explicitly looking for the period.  Your easiest
> solution would be to just write your own parser.
>
>
> On Monday, October 30, 2017 at 11:20:51 AM UTC-4, Diego Medina wrote:
>>
>> Hi,
>>
>> I need to parse datetime data given in a csv file, the format I get (I
>> get a lot of diff ones but the latest is):
>>
>> 20060102 15:04:05:000
>>
>> but if I use that with time.Parse, it doesn't parse the millisecond part,
>> tells me:
>>
>> parsing time "20170628 12:11:00:103" as "20060102 15:04:05:000": cannot 
>> parse "103" as ":000"
>>
>>
>>
>> if I change the format, from :000 to .000 and then change my source time,
>> to be  12:11:00.103
>>
>> it does parse. Is there a way to avoid having to edit the source file, so
>> I can just take the datetime info as it is in the file?
>>
>> playground example:
>>
>> https://play.golang.org/p/cHTDxFYmrF
>>
>> Thanks
>>
>> 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.
>

-- 
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.

Reply via email to