开发者

Cast from renamed type in google go

I'm trying to write suitable method of converting appengine/datastore.Time type to string. This type is declared as type Time int64 But when i'm trying to use it as int64 value:

localTime := time.SecondsToLocalTime(t/1000)

I'm receiving error message

cannot use t / 1000 (type datastore.Time) as type int64 in function argument

Assignment from int64 to Time typed 开发者_JS百科variable is successfull, but how can i cast it back?


do it like

time.SecondsToLocalTime(int64(t)/1000)

See more in the documentation about Conversions

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜