| Crates.io | uts2ts |
| lib.rs | uts2ts |
| version | 1.0.0 |
| created_at | 2023-07-25 17:41:10.252947+00 |
| updated_at | 2025-09-15 21:55:56.292972+00 |
| description | Convert a unix timestamp (seconds) to a struct {year, month, day, hour, minute, second, weekday}. |
| homepage | https://github.com/tessus/uts2ts |
| repository | https://github.com/tessus/uts2ts |
| max_upload_size | |
| id | 925812 |
| size | 18,872 |
uts2ts is a simple function that does only one thing:
It converts a unix timestamp to something slightly more useful. ;-)
So why then? Well, it's not always warranted to pull in a myriad of dependencies when you need this one, little thingy.
For complex time and date calculations and manipulations, please refer to the more functional complete crates chrono and time.
Please note that the as_string() method is just a quick way of generating a human readable date/time string that
use uts2ts::uts2ts;
fn main() {
let ts = uts2ts(204158100);
// Timestamp { year: 1976, month: 6, day: 20, hour: 22, minute: 35, second: 0, weekday: 0 }
println!("{:?}", ts);
// 1976-06-20 22:35:00
println!("{}", ts.as_string());
// 1976-06-20 22:35:00 +0000
println!("{}", ts.as_string_utc());
}
This library does not have any dependencies and is feature complete.
Therefore there aren't any regular updates and as a result it might seem that this project has been abandoned. However, this is not the case.
This project is maintained.