Class: Nx::DateTime

Inherits:
Object
  • Object
show all
Defined in:
lib/nx/version.rb,
lib/nx/date-time.rb

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.dateObject



13
14
15
# File 'lib/nx/date-time.rb', line 13

def date
  format "%Y-%m-%d"
end

.date_timeObject



21
22
23
# File 'lib/nx/date-time.rb', line 21

def date_time
  format "%Y-%m-%d %H:%M:%S"
end

.format(fmt) ⇒ Object



8
9
10
11
# File 'lib/nx/date-time.rb', line 8

def format(fmt)
  time = Time.now
  time.strftime(fmt)
end

.nowObject



4
5
6
# File 'lib/nx/date-time.rb', line 4

def now
  Time.now.to_i
end

.timeObject



17
18
19
# File 'lib/nx/date-time.rb', line 17

def time
  format "%H:%M:%S"
end

.ymObject



25
26
27
# File 'lib/nx/date-time.rb', line 25

def ym
  format "%Y-%m"
end

.ymd_hmsObject



29
30
31
# File 'lib/nx/date-time.rb', line 29

def ymd_hms
  format "%Y%m%d_%H%M%S"
end