parse_date

Function parse_date 

Source
pub fn parse_date(datetime: &str) -> Result<i64>
Expand description

Parses a date string and returns the timestamp in milliseconds since Unix epoch

Supports multiple date formats:

  • ISO 8601: “2024-01-01T12:00:00.000Z” or “2024-01-01T12:00:00Z”
  • Space-separated: “2024-01-01 12:00:00”
  • Without timezone: “2024-01-01T12:00:00.389”

§Arguments

  • datetime - Date string in one of the supported formats

§Returns

Timestamp in milliseconds since Unix epoch

§Example

use ccxt_core::time::parse_date;

let ts1 = parse_date("2024-01-01T12:00:00.000Z").unwrap();
let ts2 = parse_date("2024-01-01 12:00:00").unwrap();
assert!(ts1 > 0);
assert!(ts2 > 0);