Convert Dates.jsl creates a data table, specifies the data input format, changes the column to a numeric continuous column, and applies the m/d/y format (图 17.1).
Add Rows( 3 ),
<<Modal,
tb = Text Box(
dt << Data Table Window();
When you change the column’s data type from character to numeric, defining the format in which the data were entered is important. In this example, Informat( "d/m/y" ) defines the input format. Format( "m/d/y" ) defines the new display format. If Informat() is omitted, the Format() value is applied as both the input and display format. This results in missing values for some data.
Modify Convert Dates.jsl to see for yourself.
1.
|
Open Convert Dates.jsl from the sample scripts folder.
|
2.
|
Right-click the script window and select Show Line Numbers.
|
4.
|
On line 27, delete Informat( "d/m/y" ), (including the comma).
|
Format( "m/d/y" ) is applied to the column. Only "01/25/2010" appears in the column. The other values are missing; "30/09/2009" and "15/12/2013" are not valid m/d/y values.