This is a simple little example of how to use a JavaScript Regular Expression in Adobe LiveCycle Designer to change the format of a date in code. You can just copy and paste the code below into designer to try it out.
———————————————-
/**
Adobe LiveCycle Designer JavaScript
How a date in from YYYY-MM-DD format to DD/MM/YYYY in code.
**/
var re = /^(\d{4})\-(\d{2})\-(\d{2})$/;
var origDate = “2011-04-12″;
var newDate = origDate.replace(re, “$2/$3/$1″);
app.alert(“newDate = ” + newDate);
var matchArray = origDate.match(re);
app.alert(“matchArray = ” + matchArray);
/**
Now you have a variable (newDate) containing (12/04/2011) and an array (natchArray) containing (2011-04-12,2011,04,12).
**/
———————————————-
Rod Swift
PDF Form Developer
SwiftForms
http://swiftforms.com.au