<分区>
我想格式化 Time.Now 函数以显示 YYYY-MM-DD HH:MM:SS 而不是:“2018-03-09 09:47:19 +0000” 该函数需要放在时间中.现在功能。
require ‘roo’
require ‘roo-xls’
require ‘byebug’
file_name = ARGV.first || “Template.xlsx”
excel_file = Roo::Spreadsheet.open(“./#{file_name}“, extension: :xlsx)
xml = Nokogiri::XML::Builder.new(encoding: ‘ISO-8859-15’) do |xml|
xml.LIEFERUNG
(“xmlns”: “http://testtest”, “xmlns:xsi”: “testtesttest”, “xsi:schemaLocation”: “testtest”, “version”: “1.0”, “erstellzeit”: “#{Time .now.strftime(“%F %H:%M:%S”)}“, “stufe”: “Produktion”) 做
xml.ABSENDER do
xml.KREDITGEBERNR “1206992”
xml.Name “ALL”
end
xml.MELDUNGGROMIO(“erstellzeit”: “#{Time.now.strftime(“%F %H:%M:%S”)}“) do
xml.MELDER do
xml.KREDITGEBERNR “55093629”
xml.Name “Finance”
end
File.open(“output.xml”, “w”) { |file| file.write(xml) }