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

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

Awesome Lists containing this project

README

          

# SixArm.com → Ruby →
Time.stamp method for ISO RFC formats

[![Gem Version](https://badge.fury.io/rb/sixarm_ruby_time_stamp.svg)](http://badge.fury.io/rb/sixarm_ruby_time_stamp)
[![Build Status](https://travis-ci.org/SixArm/sixarm_ruby_time_stamp.png)](https://travis-ci.org/SixArm/sixarm_ruby_time_stamp)
[![Code Climate](https://api.codeclimate.com/v1/badges/f6a1b785a22692ac6a92/maintainability)](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"