Advanced programming / Mapping native and Java data types |
When calling a Java™ method with an expression evaluating to a DATE, the runtime system converts the DATE value to an instance of the com.fourjs.fgl.lang.FglDate class implemented in FGLDIR/lib/fgl.jar. You can then manipulate the date from within the Java code.
You must add FGLDIR/lib/fgl.jar to the class path in order to compile Java code with com.fourjs.fgl.lang.FglDate class.
The com.fourjs.fgl.lang.FglDate class implements following:
Method | Description |
---|---|
String toString() |
Converts the DATE value to a String object representing the date in format: YYYY-MM-DD |
static void valueOf( String val) |
Creates a new FglDate object from a String object representing a date in the format YYYY-MM-DD. |
public static void useDate(FglDate d) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar cal = Calendar.getInstance(); cal.setTime( sdf.parse(d.toString()) ); ... }
IMPORT JAVA com.fourjs.fgl.lang.FglDate MAIN DEFINE d com.fourjs.fgl.lang.FglDate LET d = FglDate.valueOf("2008-12-23") DISPLAY d.toString() END MAIN