You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/config/initializers/time_format.rb

29 lines
558 B

Time::DATE_FORMATS[:db2] = '%Y-%m-%d %H:%M:%S'
Time::DATE_FORMATS[:default] = ->(time){
Time.zone = 'Beijing'
t = Time.zone.at time
t.strftime '%Y-%m-%d %H:%M:%S'
}
Time::DATE_FORMATS[:sh] = ->(time){
t = Time.zone.at time
t.strftime '%y-%m-%d %H:%M:%S'
}
Time::DATE_FORMATS[:date] = ->(time){
t = Time.zone.at time
t.strftime '%Y-%m-%d'
}
Time::DATE_FORMATS[:h] = ->(time){
t = Time.zone.at time
t.strftime '%H:%M'
}
Time::DATE_FORMATS[:datetime] = '%Y-%m-%d %H:%M'
Date::DATE_FORMATS[:date] = ->(date){
date.strftime '%Y-%m-%d'
}