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 myText.toDuration() converts into the Date type not into Duration. How can I do that?

asked 17.03.2010 at 04:26

Matthias%20Lang's gravatar image

Matthias Lang
accept rate: 0%

You can use a literal for Duration objects:

Duration d = 'P2D';

answered 19.03.2010 at 09:47

Christian%20Strebel's gravatar image

Christian St... ♦
accept rate: 88%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 17.03.2010 at 04:26

Seen: 1,250 times

Last updated: 17.03.2010 at 04:26