Insert value to Db

HI All
could you please explain how to convert date time to my sql format.
example
1.jul-16-201918:04:56 to my sql fprmat 2006-02-01 15:04:05

1 Like

Check date formats in https://programming.guide/go/format-parse-string-time-date-example.html

2 Likes
mySqlToday := time.Now().Format("2006-01-02 15:04:05")
1 Like

I am under the assumption that you have a string in the format: jul-16-201918:04:56 and you want to store it in a database as a time. If that’s what you’re trying to do, then you probably only need to parse the string as a date using the notation Yamil_Bracho linked to. For your string, I think the format string is: "Jan-02-200615:04:05", but I haven’t tested it.

1 Like

You shouldn’t concern the format because you can pass it in MySQL as time.Time.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.