rbatis / fastdate

fastdate
Apache License 2.0
16 stars 5 forks source link

How to support time before christ? #4

Open gy0801151351 opened 1 year ago

gy0801151351 commented 1 year ago

The structs FastDateTime and Date use u8, u16 to save time data. But now, I would like to save a time before christ, such as "-0001-01-01". Is there any way to support this?

zhuxiujia commented 1 year ago

The structs FastDateTime and Date use u8, u16 to save time data. But now, I would like to save a time before christ, such as "-0001-01-01". Is there any way to support this?

you can use this code

DateTime {
    /// 0...999999999
    nano:0,
    /// 0...59
    sec: 0,
    /// 0...59
    min: 0,
    /// 0...23
    hour: 0,
    /// 1...31
    day: 0
    /// 1...12
    mon: 0,
    /// 0000...9999
    year: 0,
    /// timezone offset seconds
    offset: 0,
}