Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
var myNode = $Xml.Parse("<Customer><Name>John</Name><BirthDate>2014-01-31T09:00:00+02:00</BirthDate></Customer");
var result = myNode.Format('<p>Birth date : {{Customer/BirthDate}}</p>');

// result : <p>Birth date : 01/31/2014 09:00:00 +02:00</p>

Scripting example

A way to remove time from date node

Code Block
$Xml.SetValue('Test/testdate', new DateTimeOffset());  // testdate will be saved to XML as "2015-11-12T15:27:16.2568549+02:00"
$Xml.SetValue('Test/testdate', $Xml.Format("{{ format(Test/testdate,'dd/MM/yyyy') }}"));  // testdate2 will be saved to XML as "2015-12-11T00:00:00+02:00"

// resultĀ : 2015-12-11T00:00:00+02:00

Conditional Formatting

If conditional rendering needed format below can be used;

...