Change the Date Format using 4GL Script

By | August 31, 2020

As we know, Sage X3 supports multiple date formats as per the users requirement. The default date format in Sage X3 is setup in setup–> Parameters. For the developers who wants to manipulate date field value, can use date functions in 4GL. Also there is inbuilt string function which can be useful for the developers to manipulate date using 4GL.

In this blog, we will see how we can manipulate date format using “format$”string function.

New Stuff: User Restrictions on Purchase Inquiry Screen

Syntax for date format
Syntax for date format

Syntax: format$(“format required”,”Date value”)

Let’s consider an example, format$(“YYYY[-]MM[-]DD”,date$) , Here we considered.

“YYYY-MM-DD” format and “date$” function gives us current date and we change the current date format of system to required format in our code.

In the above format square brackets i.e. “[ ]”are used to represent the constant value or spaces between date characters. The given date format is stored as a string in the system.

Output
Output

Below are some examples of the date formats with output which helps you to change the date format in 4GL script.

Examples of the date formats
Examples of the date formats

So by using Format$string function 4GL scripts, developers can change the date format according to users requirement& also can used in 4GL.