(localDate time.Time)
| 207 | } |
| 208 | |
| 209 | func 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 | |
| 224 | func Int32ToDate(val int32) (time.Time, error) { |
| 225 | date := int(val) |
no outgoing calls
no test coverage detected
searching dependent graphs…