go-openapi / strfmt

openapi toolkit common string formats

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No documentation on how to convert a time.Time to strfmt.DateTime

ryanwalls opened this issue · comments

I have a strfmt.DateTime field and I'm trying to set a time.Time value to it. What is the proper way to do it? I see a ParseDateTime method but seems painful to convert time.Time to a string and then parse it.

Side note: more documentation in the README would really be nice. Pretty bare bones right now.

you should be able to do: strfmt.DateTime(time.Now())

Oh yeah, see now that strfmt.DateTime is just a time.Time. Thanks. Would still like documentation on the repo with examples, but feel free to close.

You are right, we should probably add more documentation :) Thank you for the suggestion! This is a community project however, so feel free to help out with this. After all, you have the unique perspective from a newcomer, so you are perfectly suited to know what information would help out a starter.

Took me a while until I find this!
https://golang.org/ref/spec#Conversions
x's type and T have identical underlying types.

@GlenDC when would be a good place to add those conversion examples? The Readme?