#date-time #moment #date #time #day

dayjs

a date and time library for Rust, inspired by day.js

3 releases

Uses new Rust 2024

new 0.1.2 Mar 26, 2025
0.1.1 Oct 24, 2024
0.1.0 Oct 24, 2024

#310 in Date and time

Download history 1/week @ 2024-12-04 1/week @ 2024-12-11 3/week @ 2025-02-05

139 downloads per month

MIT license

11KB
210 lines

dayjs

dayjs api for Rust

Attributes

time: utc timestamp

timezone: -12 ~ 12

localtime = time + (timezone * 3600)

Usage

fn main() {
    // default
    let now = dayjs::now();
    // timestamp
    let date3 = dayjs::from_timestamp(1729746657208);
    // GMT
    let date1 = dayjs::from_str("Thu, 24 Oct 2024 05:12:08 GMT");
    // ISO
    let date2 = dayjs::from_str("2024-10-24T05:12:15.395Z");
}

Dependencies

~1MB
~18K SLoC