would you like tell me how to use DateTime method you may have notice,I'm not fluently English because of i'm Japanese i try writing question in English, and sorry if you are suffer from reading my English!!
i want to convert from integer to Data.i can convert from string to data, but i can convert from integer to data.
ex(using my controller):
def time_from_excel_date_time(excel_date)
if excel_date.is_a?(String) || excel_date.is_a?(Date)
date = excel_date.in_time_zone
elsif excel_date.is_a?(Integer)
other_date = DateTime.new(excel_date).in_time_zone
date = other_date.in_time_zone
else
return nil
end
date
end
=> excel_date
=> 44235
>> DateTime.new(44235).in_time_zone
=> Thu, 01 Jan 44235 09:00:00 JST +09:00
config/application
config.time_zone = 'Tokyo'
config.i18n.default_locale = :ja
config.i18n.available_locales = %i[ja en]
config.active_record.time_zone_aware_types = [:datetime]
config.active_record.belongs_to_required_by_default = true
i want to gain like a bottom shape
date = "???/???/???"
which do I?
change from (=> Thu, 01 Jan 44235 09:00:00 JST +09:00) used DateTime.new()method to ("???/???/???") by other method?
or
change from (excel_date) to ("???/???/???") by other method except method of DateTime.new()?
i try to both skill of programing and english!!
thank you for reading!!