to_long_datetime

Function to_long_datetime 

Source
pub fn to_long_datetime(datetime: &OffsetDateTime) -> String
Expand description

Convert a time::OffsetDateTime to a long date string. This is used in the AWS credential scope. It is always UTC, YYYYMMDD’T’HHMMSS’Z’, sortable and lexicographically comparable.

§Examples

use time::OffsetDateTime;
use common_s3_headers::aws_format::to_long_datetime;

let datetime = OffsetDateTime::from_unix_timestamp(0).unwrap();
let result = to_long_datetime(&datetime);
assert_eq!(result, "19700101T000000Z");

let datetime = OffsetDateTime::from_unix_timestamp(1_000_000_000).unwrap();
let result = to_long_datetime(&datetime);
assert_eq!(result, "20010909T014640Z");