#date #time


Date and time library for Rust. Aims to be feature rich, lightweight and easy-to-use.

7 releases (4 breaking)

0.4.0 May 18, 2023
0.3.0 Apr 11, 2023
0.2.0 Aug 25, 2022
0.1.0 Jul 24, 2022
0.0.2 Jul 13, 2022

#69 in Date and time

Download history 12/week @ 2023-02-13 34/week @ 2023-02-20 49/week @ 2023-02-27 61/week @ 2023-03-06 52/week @ 2023-03-13 40/week @ 2023-03-20 8/week @ 2023-03-27 56/week @ 2023-04-03 107/week @ 2023-04-10 20/week @ 2023-04-17 33/week @ 2023-04-24 67/week @ 2023-05-01 42/week @ 2023-05-08 51/week @ 2023-05-15 27/week @ 2023-05-22 19/week @ 2023-05-29

143 downloads per month


4.5K SLoC


Date and time library for Rust. Feature rich, lightweight and easy-to-use.


Astrolabe is a date and time library for Rust which aims to be feature rich, lightweight (zero dependencies) and easy-to-use. It implements formatting, parsing and manipulating functions for date and time values.


  • Formatting and parsing with format strings based on Unicode Date Field Symbols
  • RFC 3339 timestamp parsing and formatting
  • Manipulation functions to add, subtract, set and clear date units
  • Cron expression parser (With feature flag cron)
  • Timezone offset
  • Zero dependencies
  • Serde serializing and deserializing (With feature flag serde)


A basic example which demonstrates creating, formatting and manipulating a DateTime instance.

use astrolabe::{DateTime, TimeUtilities, Precision};

// Create a DateTime instance from year, month, and days (day of month)
let date_time = DateTime::from_ymd(2022, 5, 2).unwrap();

// Use the format function to freely format your DateTime instance
assert_eq!("2022/05/02", date_time.format("yyyy/MM/dd"));

// Create a new instance with a modified DateTime
// The previous instance is not modified and is still in scope
let modified_dt = date_time

assert_eq!("2022/05/02 11:23:00", modified_dt.format("yyyy/MM/dd HH:mm:ss"));
assert_eq!("2022-05-02T11:23:00Z", modified_dt.format_rfc3339(Precision::Seconds));

To see all implementations for the DateTime struct, check out it's documentation.


This crate uses the Rust 2021 Edition and requires at least version 1.56.


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.