MCPcopy Create free account
hub / github.com/apache/iotdb-client-go / DateToInt32

Function DateToInt32

client/utils.go:209–222  ·  view source on GitHub ↗
(localDate time.Time)

Source from the content-addressed store, hash-verified

207}
208
209func DateToInt32(localDate time.Time) (int32, error) {
210 if localDate.IsZero() {
211 return 0, errors.New("date expression is null or empty")
212 }
213
214 year := localDate.Year()
215 if year < 1000 || year > 9999 {
216 return 0, errors.New("year must be between 1000 and 9999")
217 }
218
219 // Convert to YYYY/MM/DD format
220 result := year*10000 + int(localDate.Month())*100 + localDate.Day()
221 return int32(result), nil
222}
223
224func Int32ToDate(val int32) (time.Time, error) {
225 date := int(val)

Callers 2

valuesToBytesFunction · 0.85
SetValueAtMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…