Skip to end of metadata
Go to start of metadata

Description

You may have the need to have user-entered dates all conform to a certain date format, such as mm/dd/yyyy, regardless of how the users have entered the dates.

Solution

Create a script to adjust the date mask.

The following script is an example of how to manipulate a date Keyboard field  for dates using the mm/dd/yyyy format:

 

//define variables

var input1 = label.fields.field.(@name == 'Date').@data;

var myarray = new Array (0,0,0);

var myarray = input1.split("/");

if (myarray[0]!="")   {   if (myarray[0].length == 1)

    {myarray[0] = "0"+myarray[0];}

  if (myarray[1].length == 1)

    {myarray[1] = "0"+myarray[1];}

  if (myarray[2].length == 2)

    {myarray[2] = "20"+myarray[2];}

  if (myarray[2].length == 1)

    {myarray[2] = "200"+myarray[2];}

  }

label.fields.field.(@name == 'Date').@data = myarray[0]"/"+myarray[1]"/"+myarray[2];

 

Article Number

 2013012

Versions

 Loftware Label Manager

Environment

All supported installation environments.