Skip to content

Instantly share code, notes, and snippets.

@pcasaretto
Created September 8, 2016 18:14
Show Gist options
  • Save pcasaretto/1ecdae5b6598bd83872b3165df6c3a37 to your computer and use it in GitHub Desktop.
Save pcasaretto/1ecdae5b6598bd83872b3165df6c3a37 to your computer and use it in GitHub Desktop.
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