aboutsummaryrefslogtreecommitdiff
path: root/src/deps/zig-datetime/README.md
blob: d432e4f326e25f9c27b27bfe5d45a45ed6bd7b3f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Zig Datetime

[![Build Status](https://travis-ci.org/frmdstryr/zig-datetime.svg?branch=master)](https://travis-ci.org/frmdstryr/zig-datetime)
[![codecov](https://codecov.io/gh/frmdstryr/zig-datetime/branch/master/graph/badge.svg)](https://codecov.io/gh/frmdstryr/zig-datetime)


A datetime module for Zig with an api similar to python's Arrow.

> NOTE: This does not implement DST.


```zig

const allocator = std.heap.page_allocator;
const date = try Date.create(2019, 12, 25);
const next_year = date.shiftDays(7);
assert(next_year.year == 2020);
assert(next_year.month == 1);
assert(next_year.day == 1);

// In UTC
const now = Datetime.now();
const now_str = try now.formatHttp(allocator);
defer allocator.free(now_str);
std.debug.warn("The time is now: {}\n", .{now_str});
// The time is now: Fri, 20 Dec 2019 22:03:02 UTC


```
'//www.gravatar.com/avatar/b71ccf38c38e65b7dcb0aea91898f819?s=13&d=retro' width='13' height='13' alt='Gravatar' /> Derrick Farris 3-0/+44 2023-02-13Fixes https://github.com/oven-sh/bun/issues/1456Gravatar Jarred Sumner 8-1/+148