Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/atabary/moment

Moment is designed to bring easy date and time handling to Elixir.
https://github.com/atabary/moment

Last synced: 4 days ago
JSON representation

Moment is designed to bring easy date and time handling to Elixir.

Awesome Lists containing this project

README

        

# Moment

[![Build Status](http://img.shields.io/travis/atabary/moment/master.svg)](https://travis-ci.org/atabary/moment)

Moment is designed to bring easy date and time handling to Elixir. Its semantic (notably for formatting/parsing) is inspired by [Moment.js](http://momentjs.com/).

## Examples

```elixir
iex(1)> Moment.now()
%Moment{day: 11, hour: 15, minute: 8, month: 9, nanosecond: 228523000,
offset: 540, second: 13, year: 2014}

iex(2)> Moment.utcnow()
%Moment{day: 11, hour: 6, minute: 8, month: 9, nanosecond: 84602000, offset: 0,
second: 17, year: 2014}

iex(3)> Moment.format(Moment.now(), "YYYY/MM/DD HH:mm")
"2014/09/11 15:08"

iex(4)> Moment.parse!("2014/09/11 15:08", "YYYY/MM/DD HH:mm")
%Moment{day: 11, hour: 15, minute: 8, month: 9, nanosecond: 0, offset: 540,
second: 0, year: 2014}
```