GMT-based SOAP4R SOAPDateTime format

Application uses SOAP4r to use API / SOAP

But SOAP is returned :: SOAPTimeFormat 2015-11-15T16: 59: 521468.7999999999999545-04: 00

chkout.add('purchasedDt ', SOAP::SOAPDateTime.new(basket.purchase_Date))

Using strftime ('% Y-% m-% dT% H:% M:% S') gives the following

chkout.add('purchasedDt ', SOAP::SOAPDateTime.new(basket.purchase_Date.strftime('%Y-%m-%dT%H:%M:%S')))

2015-11-15T16: 59: 52Z

What is needed for the application 2015-11-15 16:59:52 -0400 Please inform ... you need a format in yyyy-mm-DDThh: mm: ss - / + GMT

-Fransis

+4
source share
2 answers

A simple change to your strftime, and you can find out more in the document for Time # strftime

basket.purchase_Date.now.strftime('%Y-%m-%d %H:%M %z')
=> "2016-04-26 22:48 -0400"
+2
source

, iso8601. Time#xmlschema , iso8601:

basket.purchase_Date.xmlschema
#=> "2015-11-15T16:59:52-04:00"

:

chkout.add('purchasedDt ', SOAP::SOAPDateTime.new(basket.purchase_Date.xmlschema))
+2

All Articles