Created
September 8, 2016 18:14
-
-
Save pcasaretto/1ecdae5b6598bd83872b3165df6c3a37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DMMT | |
module Time | |
# get current Time | |
def self.now | |
Time.zone.now | |
end | |
# get current Dime | |
def self.today | |
Time.zone.today | |
end | |
# build Time | |
def self.new(*args) | |
Time.zone.local(*args) | |
end | |
# Time from unix timestamp | |
def self.at(timestamp) | |
Time.zone.at(timestamp) | |
end | |
# parse time (simple) | |
def self.parse(str) | |
Time.zone.parse(str) | |
end | |
# parse time with specific format | |
def self.strptime(str, format) | |
Time.zone.strptime(str, format) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment