parse_timestamp

Function parse_timestamp 

Source
pub fn parse_timestamp(
    input: &str,
    sql_format: &str,
) -> Result<NaiveDateTime, ExecutorError>
Expand description

Parse a timestamp string using SQL format string

ยงExamples

use chrono::{DateTime, NaiveDateTime};
use vibesql_executor::evaluator::date_format::parse_timestamp;
let expected = DateTime::from_timestamp(1710513045, 0).unwrap().naive_utc();
assert_eq!(parse_timestamp("2024-03-15 14:30:45", "YYYY-MM-DD HH24:MI:SS"), Ok(expected));