(val int32)
| 222 | } |
| 223 | |
| 224 | func 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 | |
| 239 | func bytesToDate(bys []byte) (time.Time, error) { |
| 240 | return Int32ToDate(bytesToInt32(bys)) |
no outgoing calls
searching dependent graphs…