https://github.com/sixarm/sixarm_ruby_time_stamp
SixArm.com → Ruby → Time.stamp method for ISO RFC formats
https://github.com/sixarm/sixarm_ruby_time_stamp
gem iso rfc ruby time timestamp
Last synced: over 1 year ago
JSON representation
SixArm.com → Ruby → Time.stamp method for ISO RFC formats
- Host: GitHub
- URL: https://github.com/sixarm/sixarm_ruby_time_stamp
- Owner: SixArm
- License: other
- Created: 2011-11-08T03:02:08.000Z (over 14 years ago)
- Default Branch: main
- Last Pushed: 2023-09-15T19:29:14.000Z (almost 3 years ago)
- Last Synced: 2025-02-06T00:23:47.159Z (over 1 year ago)
- Topics: gem, iso, rfc, ruby, time, timestamp
- Language: Ruby
- Homepage: http://sixarm.com
- Size: 386 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# SixArm.com → Ruby →
Time.stamp method for ISO RFC formats
[](http://badge.fury.io/rb/sixarm_ruby_time_stamp)
[](https://travis-ci.org/SixArm/sixarm_ruby_time_stamp)
[](https://codeclimate.com/github/SixArm/sixarm_ruby_time_stamp/maintainability)
* Git:
* Doc:
* Gem:
* Contact: Joel Parker Henderson,
* Project: [changes](CHANGES.md), [license](LICENSE.md), [contributing](CONTRIBUTING.md).
## Introduction
Provides timestamp methods Time.stamp and Time#stamp
For docs go to
Want to help? We're happy to get pull requests.
## Install
### Gem
To install this gem in your shell or terminal:
gem install sixarm_ruby_time_stamp
### Gemfile
To add this gem to your Gemfile:
gem 'sixarm_ruby_time_stamp'
### Require
To require the gem in your code:
require 'sixarm_ruby_time_stamp'
## Examples
Generate a time stamp using the defaults:
Time.stamp #=> "2020-12-31T12:59:59.000000000Z"
Defaults:
* The current time
* The UTC time zone a.k.a. Zulu time zone a.k.a. "Z" time zome.
* Default RFC ISO format: "%Y-%m-%dT%H:%M:%S.%NZ'"
* Nanosecond precision
Set a different format:
Time.stamp_format = "%M/%D %H:%M"
Time.stamp #=> "12/31 12:59"
The same methods are also available for an instance:
t = Time.now
t.stamp #=> "2020-12-31T12:59:59.000000000Z"
t.stamp_format = "%M/%D %H:%M"
t.stamp #=> "12/31 12:59"