Class: SystemTimeFormat

Inherits:
Object
  • Object
show all
Defined in:
lib/system_time_format.rb

Class Method Summary collapse

Class Method Details

.conver_system_date_to_ruby_date_format(windows_date_patorn) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/system_time_format.rb', line 17

def self.conver_system_date_to_ruby_date_format windows_date_patorn
  windows_date_patorn.sub!("yyyy", "%Y")
  windows_date_patorn.sub!("yy", "%y")
  windows_date_patorn.sub!("MMMM", "%B")
  windows_date_patorn.sub!("MMM", "%b")
  windows_date_patorn.sub!("MM", "%m")
  windows_date_patorn.sub!("M", "%-m")
  windows_date_patorn.sub!("dddd", "%A")
  windows_date_patorn.sub!("ddd", "%a")
  windows_date_patorn.sub!("dd", "%abc")
  windows_date_patorn.sub!("d", "%-d")
  windows_date_patorn.sub!("%abc", "%d")
  windows_date_patorn.sub!("HH", "%abc")
  windows_date_patorn.sub!("H", "%k")
  windows_date_patorn.sub!("%abc", "%H")
  windows_date_patorn.sub!("hh", "%I")
  windows_date_patorn.sub!("h", "%l")
  windows_date_patorn.sub!("tt", "%P")
  windows_date_patorn.sub!("mm", "%M")
  windows_date_patorn.sub!("ss", "%S")
  windows_date_patorn.sub!("Z", "%Z")
end

.get_system_date_format(powershell_function) ⇒ Object



40
41
42
# File 'lib/system_time_format.rb', line 40

def self.get_system_date_format(powershell_function)
  Open3.capture3('powershell [Globalization.Cultureinfo]::CurrentCulture.DateTimeFormat.' + powershell_function)
end