Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sudodios/persian-date-rust
Persian Date for rust
https://github.com/sudodios/persian-date-rust
chrono date datetime persian-date persian-datetime rust rust-lang
Last synced: 3 months ago
JSON representation
Persian Date for rust
- Host: GitHub
- URL: https://github.com/sudodios/persian-date-rust
- Owner: SudoDios
- License: lgpl-3.0
- Created: 2024-08-29T12:57:15.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-08-30T09:53:05.000Z (4 months ago)
- Last Synced: 2024-09-29T21:02:13.422Z (3 months ago)
- Topics: chrono, date, datetime, persian-date, persian-datetime, rust, rust-lang
- Language: Rust
- Homepage:
- Size: 73.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Persian Date (Rust)
Persian Date for Rust based on chrono date-time library
[![crates.io](https://img.shields.io/crates/v/persian_date.svg)](https://crates.io/crates/persian_date) [![Documentation](https://img.shields.io/badge/Docs-persian_date-blue.svg)](https://docs.rs/persian_date/latest/persian_date)
## Installation
Add this dependency in your Cargo.toml file
```toml
[dependencies]
persian_date = "1.0.1"
```## Usage
```rust
use persian_date::structure::PDate;let pdate = PDate::now(); // initialize date
println!("{}",pdate); // formatted date
println!("{}",pdate.year()); // jalali year
println!("{}",pdate.month()); // jalali month
println!("{}",pdate.day()); // jalali day
println!("{}",pdate.day_of_week()); // day of week from saturday
// and more ...
```
Full documentation in [docs.ir](https://docs.rs/persian_date/latest/persian_date/index.html)## Formatting
Date formatting in this library is similar to [chrono](https://docs.rs/chrono/latest/chrono/format/strftime/index.html)
```rust
pdate.format("%Y-%m-%d %H:%M:%S")
```