add iso8601 string to timestamp
This commit is contained in:
parent
4b26bc884f
commit
b44ea5c3e8
|
@ -57,6 +57,10 @@ pub fn timestampToDateTime(timestamp: i64) DateTime {
|
||||||
return DateTime{ .day = day, .month = month, .year = year, .hour = hours, .minute = minutes, .second = seconds };
|
return DateTime{ .day = day, .month = month, .year = year, .hour = hours, .minute = minutes, .second = seconds };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn parseIso8601ToTimestamp(data: []const u8) !i64 {
|
||||||
|
return try dateTimeToTimestamp(try parseIso8601ToDateTime(data));
|
||||||
|
}
|
||||||
|
|
||||||
const IsoParsingState = enum { Start, Year, Month, Day, Hour, Minute, Second, Millisecond, End };
|
const IsoParsingState = enum { Start, Year, Month, Day, Hour, Minute, Second, Millisecond, End };
|
||||||
/// Converts a string to a timestamp value. May not handle dates before the
|
/// Converts a string to a timestamp value. May not handle dates before the
|
||||||
/// epoch
|
/// epoch
|
||||||
|
|
Loading…
Reference in New Issue
Block a user