easy_time

Crates.ioeasy_time
lib.rseasy_time
version0.1.5
sourcesrc
created_at2023-10-08 19:08:55.325238
updated_at2024-12-08 19:09:12.159997
descriptionpackage for handling time in rust more easily
homepage
repositoryhttps://github.com/mohamadzoh/easy_time
max_upload_size
id997387
size31,658
Mohamad Al Zohbie (mohamadzoh)

documentation

README

EasyTime Library

The EasyTime library is a Rust crate that provides a simple and flexible way to perform date and time calculations with ease. It leverages the chrono library to handle date and time manipulations while allowing you to work with various time zones and perform operations like adding or subtracting seconds, minutes, hours, days, months, and years from the current time.

Features

  • Easy-to-use API for date and time calculations.
  • Support for working with local time and UTC time.
  • Precise handling of leap years in month and year calculations.
  • Calculation methods for adding or subtracting seconds, minutes, hours, days, months, years, decades, centuries and millenniums.

Installation

To use the EasyTime library in your Rust project, add it as a dependency in your Cargo.toml:

[dependencies]
easytime = "0.1.4"

Usage

Here's a basic example of how to use the EasyTime library:

extern crate easytime;
use easytime::{EasyTime, Local};

fn main() {
    // Create an EasyTime instance with a value of 10 seconds.
    let easy_time = EasyTime::new(10);

    // Calculate the time 10 seconds from now.
    let future_time = easy_time.seconds_from_now();

    // Calculate the time 10 seconds ago.
    let past_time = easy_time.seconds_ago();

    println!("Future Time: {}", future_time);
    println!("Past Time: {}", past_time);
}

This example demonstrates how to create an EasyTime instance, add or subtract seconds from the current time, and print the results.

Contributing

Contributions to the EasyTime library are welcome! Feel free to open issues, submit pull requests, or provide feedback to help improve this library.

Commit count: 10

cargo fmt