Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/atabary/moment
- Owner: atabary
- License: apache-2.0
- Created: 2014-09-08T08:44:18.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-10T21:12:52.000Z (about 9 years ago)
- Last Synced: 2024-10-09T00:58:04.867Z (27 days ago)
- Language: Elixir
- Size: 229 KB
- Stars: 29
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - Parse, validate, manipulate, and display dates in Elixir. (Date and Time)
- fucking-awesome-elixir - moment - Parse, validate, manipulate, and display dates in Elixir. (Date and Time)
- awesome-elixir - moment - Parse, validate, manipulate, and display dates in Elixir. (Date and Time)
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}
```