ymdhms

Function ymdhms 

Source
pub fn ymdhms(timestamp: i64, separator: Option<&str>) -> Result<String, Error>
Expand description

Formats a timestamp as “yyyy-MM-dd HH:mm:ss”

This function now includes validation using TimestampUtils::validate_timestamp().

§Arguments

  • timestamp - Timestamp in milliseconds since Unix epoch
  • separator - Optional separator between date and time (defaults to “ “)

§Returns

Formatted date string

§Example

use ccxt_core::time::ymdhms;

let ts = 1704110400000; // 2024-01-01 12:00:00 UTC
let formatted = ymdhms(ts, None).unwrap();
assert_eq!(formatted, "2024-01-01 12:00:00");

let formatted_t = ymdhms(ts, Some("T")).unwrap();
assert_eq!(formatted_t, "2024-01-01T12:00:00");