Thank you. This is helpful. I am going to replace : with . first. On Tuesday, September 13, 2016 at 9:09:31 AM UTC+5:30, Caleb Spare wrote: > > As Dave said, you should check the error, but unfortunately I think > you'll find that time.Parse doesn't handle fractional seconds that use > a character other than . as a decimal separator. > > One possible workaround would be to replace all the : with . first: > > https://play.golang.org/p/h_IMQxtoVI > > -Caleb > > On Mon, Sep 12, 2016 at 1:17 PM, Geetha Adinarayan > <gadin...@gmail.com <javascript:>> wrote: > > Hi, > > > > I am trying to parse time coming in "6/9/15 15:54:04:393 CST" format. > Note : > > before millisecond. When there is dot before millisecond, time.parse is > > working fine.. but when there is : before millisecond, time.parse does > not > > work. am I missing anything? > > > > I tried the following > > > > package main > > > > import ( > > "fmt" > > "time" > > > > ) > > > > func main() { > > const inputTime = "1/2/06 15:04:05:000 MST" > > t, _ := time.Parse(inputTime, "6/9/15 15:54:04:393 CST") > > fmt.Println(t) > > fmt.Println(t.Format("2006-01-02T15:04:05.000-0700")) > > } > > > > but I get the following > > > > 0001-01-01 00:00:00 +0000 UTC > > 0001-01-01T00:00:00.000+0000 > > > > > > > > -- > > 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 <javascript:>. > > 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.