MCPcopy Index your code
hub / github.com/apache/iotdb-client-go / Int32ToDate

Function Int32ToDate

client/utils.go:224–237  ·  view source on GitHub ↗
(val int32)

Source from the content-addressed store, hash-verified

222}
223
224func Int32ToDate(val int32) (time.Time, error) {
225 date := int(val)
226 year := date / 10000
227 month := (date / 100) % 100
228 day := date % 100
229
230 localDate := time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.UTC)
231
232 if localDate.Year() != year || int(localDate.Month()) != month || localDate.Day() != day {
233 return time.Time{}, errors.New("invalid date format")
234 }
235
236 return localDate, nil
237}
238
239func bytesToDate(bys []byte) (time.Time, error) {
240 return Int32ToDate(bytesToInt32(bys))

Callers 6

Test_QueryAllDataTypeMethod · 0.92
bytesToDateFunction · 0.85
GetValueAtMethod · 0.85

Calls

no outgoing calls

Tested by 1

Test_QueryAllDataTypeMethod · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…