Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davebryson/elixir_milliseconds
Simple library to work with milliseconds
https://github.com/davebryson/elixir_milliseconds
Last synced: 3 days ago
JSON representation
Simple library to work with milliseconds
- Host: GitHub
- URL: https://github.com/davebryson/elixir_milliseconds
- Owner: davebryson
- Created: 2015-04-08T16:58:34.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-10T00:22:31.000Z (over 9 years ago)
- Last Synced: 2024-10-07T14:18:40.398Z (27 days ago)
- Language: Elixir
- Homepage:
- Size: 137 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - Simple library to work with milliseconds in Elixir. (Date and Time)
- fucking-awesome-elixir - milliseconds - Simple library to work with milliseconds in Elixir. (Date and Time)
- awesome-elixir - milliseconds - Simple library to work with milliseconds in Elixir. (Date and Time)
README
Millseconds for Elixir
======================Convert the word version of time to milliseconds and vice-versa.
Examples
--------```elixir
import Milliseconds
# Milliseconds to readable time
convert(3600000)
# => "1h"# Readable time to milliseconds
convert("2yrs")
# => 6.31152e10# Calculate future time
# Milliseconds 24 hours from now
expires_tomorrow = future_time("24hrs")# Milliseconds 6 hrs from now
expires_later = future_time("6hrs")# Current time in milliseconds
now = current_time_millis```
Inspired by ms.js: https://github.com/rauchg/ms.js