<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Conversion of duration as a text into a variable of type duration</title><link>https://answers.axonivy.com/questions/339/conversion-of-duration-as-a-text-into-a-variable-of-type-duration</link><description>&lt;p&gt;I need to convert a string variable in the ISO8601 format (e.g. 'P2D') into a variable of type Duration to use it in a task switch. The API method &lt;code&gt;myText.toDuration()&lt;/code&gt; converts into the Date type not into Duration. How can I do that?&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/339/conversion-of-duration-as-a-text-into-a-variable-of-type-duration" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 19 Mar 2010 09:47:28 -0400</lastBuildDate><item><title>Answer by Christian Strebel</title><link>https://answers.axonivy.com/questions/339/conversion-of-duration-as-a-text-into-a-variable-of-type-duration/340</link><description>&lt;p&gt;You can use a literal for Duration objects: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Duration d = 'P2D';
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Christian Strebel</dc:creator><pubDate>Fri, 19 Mar 2010 09:47:28 -0400</pubDate><guid>https://answers.axonivy.com/questions/339/conversion-of-duration-as-a-text-into-a-variable-of-type-duration/340</guid></item></channel></rss>