Skip to content

SixArm/sixarm_ruby_time_stamp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

104 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Gem Version Build Status Code Climate

Introduction

Provides timestamp methods Time.stamp and Time#stamp

For docs go to http://sixarm.com/sixarm_ruby_time_stamp/doc

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"

About

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

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages