Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

formatter-date

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formatter-date

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

formatter-date

Format Time/DateTime with time zone offset

Gem Version Build
Status Code Climate

Installation

Add this line to your application's Gemfile:

gem 'formatter-date'

And then execute:

$ bundle

Or install it yourself as:

$ gem install formatter-date

Usage

# By default it will use the ISO8601 formatting.
formatter = Formatter::Date.new('Asia/Karachi')
formatter.format(Time.now) # "2015-02-22T03:48:07+05:00"

# Available formats iso8601, xmlschema, jisx0301, rfc3339
formatter = Formatter::Date.new('Asia/Karachi', :jisx0301)
formatter.format(Time.now) # "H27.02.22T03:48:07+05:00"

# You can also provide fractional seconds to be used with formats
formatter = Formatter::Date.new('Asia/Karachi', :iso8601, 2)
formatter.format(Time.now) # 2015-02-22T03:48:07.46+05:00

# Provide a custom string formatting (delegates to strftime)
formatter = Formatter::Date.new('Asia/Karachi', '%FT%T%:z')
formatter.format(Time.now) # "2015-02-22T03:48:07+05:00"

# Get configured time zone identifier
formatter.identifier # "Asia/Karachi"

# Get configured time zone offset
formatter.offset # (5/24)

Contributing

  1. Fork it ( https://github.com/terlar/formatter-date/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

FAQs

Package last updated on 22 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc