just for future reference, there is no format for 'this' (the format op
asked for). because this format does not have a period. i was just as
surprised. you can try yourself: https://play.golang.org/p/wv_PDwTmEOk
the documentation also states that you do not specify the fraction
seconds for parsing, when a period follows the seconds field.
On 08.02.19 15:04, Philippe DESJACQUES wrote:
Le 08/02/2019 à 01:10, Burak Serdar a écrit :
On Thu, Feb 7, 2019 at 2:28 PM Rajanikanth Jammalamadaka
<rajanika...@gmail.com> wrote:
How can I parse the following timestamp in Go?
date +%y%m%d%H%M%S%N
190207202017034235995
for the ymdHMS part, you can use:
time.Parse("060102150405",str[:12])
I don't know if time parser has something for the %N, you might need
to do it manually, line strconv.Atoi(str[12:])
Hello,
Yes there is a layout for this according to documentation :
"A fractional second is represented by adding a period and zeros to the
end of the seconds section of layout string, as in "15:04:05.000" to
format a time stamp with millisecond precision." ->
https://golang.org/pkg/time/#Time.Format
So in your case 9 "0" after period ;)
Regards,
Philippe
--
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
<mailto: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.