Reputation: 1731
so this is the xml node i am creating for Quickbooks. Sending over duration (its time kinda thingie)
XmlElement duration2 = inputXmlDoc.CreateElement("Duration");
timeTrackingAdd2.AppendChild(duration2);
duration2.InnerText = "PT0H14M0S"
as per the format, i am assuming it should convert this into 0.14 in Quickbooks. But the conversion is different from my assumption
You can see the changed value in the Image Below:
this is the image of the data transferred to QB. It converted the duration to 0.23. What could be the formula here?
Some multiple tries with different values:
PT0H1M0S 1 converts to 0.02
PT0H10M0S 10 converts to 0.17
PT0H14M0S 14 converts to 0.23
PT0H30M0S 30 converts to 0.50
which approach will help me transfer the duration from my Web Application to Quickbooks converting it into accurate duration?
Upvotes: 1
Views: 122
Reputation: 494
According to your edited example and the standard, it converts those inputs to decimal.
1 hour converts to 1, thus:
1 minute = 1/60 = 0.0166667 which rounds up to 0.02.
10 minutes = 10/60 = 0.166667 which rounds up to 0.17.
14 minutes = 14/60 = 0.23333 which rounds up to 0.23.
30 minutes = 30/60 = 0.50.
Upvotes: 2