Date/time formatting

Numerical value formatting

Text string formatting

 

« Back





Note: The illustrated examples assume that the PC localization options are set to the default values for EN. 



 

Date/time formatting

  

The syntax described in this chapter is applicable to fields that return a date / time value.
The format string can consist of one of the keywords that identify the predefined or compound formats using the syntax for the custom format.


Predfined Date/time formats

 

Syntax

Description

 

General Date

Display date and / or time corresponding to the specified number
For real numbers, view date and time. If the decimal part is absent, only the date is displayed. If the whole part is absent, only the time is displayed. The display format is defined by the system location settings.

 

Long Date

Displays the date formatted according to the system location settings related to the date in extended format.
For example: Tuesday 14 September 2004


Medium Date

Displays the date formatted according to the system location settings related to the date in medium format. For example: 14-Sep-04


Short Date

Displays the date formatted according to the system location settings related to the short format date. For example: 09/14/2004

 

Long Time

Displays the time using the system localization settings related to the extended time format; includes hours, minutes, seconds. For example 15.45.23

 

Medium Time

Displays the time in 12-hour format using hours, minutes and AM / PM qualifier. For example 03.45 PM

 

Short Time

 

Displays the time in 24-hour format. For example 17:45.

 

 

Examples:

 

Format

Expression

Result

Long Date

Now

Friday 19 October 2007

Short Time

Now

09.43

 

 

« back to Date/Time formatting

« Top

 

 

Custom Date and time formats

 

The following characters can be combined to create a custom date / time format.

 

Character

Description

 

(:)

Time Separator. Depending on the current location settings, other characters can be used as a separator. The separator divides hours, minutes and seconds into formatting. The character actually used as a separator is determined by the system location settings. Note: the character is intended without brackets.

 

(/)

Date separator. Depending on the current location settings, other characters can be used as a separator. The separator divides the digits relative to day, month and year in the formatting. The character actually used as a separator is determined by the system location settings. Note: the character is intended without brackets.

 

d

Displays the day of the month as a number without a leading zero (for example, 1).

 

dd

Display the day of the month formatting it in two digits (For example, 27 or 01)

 

ddd

Displays the abbreviated day name in the local language (for example "Mon")

 

dddd

Displays the full name of the day in the local language (for example "monday")

 

M

Displays the number of the month with no leading zero (for example, January is represented with 1).


MM

Displays the month number formatted in two digits (for example, January is represented with 01)

 

MMM

Displays the abbreviated month name, in the local language (for example, Jan).

 

MMMM

Displays the name of the month in full, in the local language (for example, January).

 

h

Displays the time without an initial zero with a 12-hour system (e.g., 2:27:15).

 

hh

Displays the time formatted in two digits, with 12-hour system (for example, 02:27:15).

 

H

Displays the time without an initial zero with a 24-hour system (for example, 14:27:15).

 

HH

Displays the formatted two-digit time with 24-hour system (as an example, 6:08:15).

 

m

Displays the minutes with no leading zero (for example, 12: 1: 15).

 

mm

Displays the minutes formatted in two digits (for example, 12:01:15).


s

Visualizza i secondi senza zero iniziale (ad esempio, 12:15:5).

 

ss

Displays the seconds with leading zero (for example, 12: 15: 05).

 

w

Display the number of the day of the week. For example, 1 for Monday, 2 for Tuesday, etc.
The numbering of the days of the week depends on the system's location settings (for example, 1 identifies Monday for a system located in Italy, but represents Sunday in a system located for the United States).

 

ww

Displays the week number in the year (1-51)

 

y

Display the day of the year (1-355 / 6)

 

yy

Displays the year formatted in two digits, with initial zero for years less than ten. (for example 04 for 2004).

 

yyyy

Displays the year in four digits (for example, 2004)

 

 

Examples:

 

Format

Express.

Result

h:mm:ss

Time

2:05:09

H:mm:ss

Time

14:05:09

HH:mm:ss

Time

02:05:09

dddd d MMMM yyyy

Date

Wednesday 8 September 2004

mm/gg/yy

Date

09/08/04

ddd dd MMM yy " – " hh:mm

now

wed 08 sep 04 – 09:05

Week " ww "Day " w

Date

Week 37 Day 3

 

 

« back to Data/Time formats

« Back to Top

 

 

 

 

Numerical values formatting

 

The syntax described in this chapter is applicable to fields that return a numerical value that must be formatted as such.
The format string can consist of one of the keywords that identify the predefined or compound formats using the syntax for the custom format.


Formati numerici predefiniti

 

Sintax

Description

 

General Number

 

Display the number without thousands separator

Currency


Displays a number with thousands separators where appropriate and two decimal places, inserting any currency symbol. The output depends on the system location settings

 

Fixed

Display at least one digit on the left and two digits to the right of the decimal point.

 

Standard

Displays a number with thousands separator, and at least one digit on the left and two digits to the right of the decimal point.

 

Percent

Displays the number formatted as a percentage (multiplied by 100 and followed by the "%" sign, always displaying two digits to the right of the decimal point.

 

Scientific

Displays the number in scientific notation, with two significant decimal digits.

 

Yes/No

Display No if the numeric value of the expression is 0; YES if different from 0. The texts No and Yes are expressed in the local language.

 

True/False

Display False if the numeric value of the expression is 0; True if the value is not equal to 0. The True and False texts are expressed in the local language.

 

On/Off

Display Off if the numeric value of the expression is 0; On if different from 0.

 

 

Examples:

 

Format

Express.

Result

Currency

ITEM1

€ 1.234,56

while ITEM1 =1234,567

 

Percent

ITEM1

5,00 %

while ITEM1 = 0,05

 

on/off

ITEM1

ON

while Item1 <> 0

 

OFF

while Item1 = 0

 

 

« back to Data/Time formats

« Back to Top

 

 

 

Custom numerical formats

 

The following characters can be combined to create a custom format. The characters are shown in brackets to make them easier to read. The brackets must be omitted.

 

 

Character

Description

 

(0)

Digit placeholder. Represents a zero or a non-zero digit. If the expression has a digit in the position corresponding to the 0 position in the formatting string, that digit is displayed; otherwise a 0 is displayed.
If the number of digits of the value to be formatted is less than the number 0 in the formatting string, both to the right and to the left of the decimal separator, the leading and trailing zeros are displayed.
If the number of decimal places in the value is greater than the number 0 on the right of the decimal separator in the formatting string, the value is rounded to the specified number of decimal places.
If the number of full digits of the value is greater than the number of 0 to the left of the decimal separator in the formatting string, the excess digits are displayed without modification.

 

(#)

Digit placeholder. Display a digit or nothing. If the expression has a digit in the position corresponding to the position of # in the formatting string, it is displayed; otherwise, nothing is displayed in that position.
The # character operates as the 0 character, except that the leading and trailing zeroes are not displayed if the value has a number of digits smaller than the number of #, both on the right and left of the decimal point.

 

(.)

Placeholder of the decimal separator. The position of the decimal separator determines the number of digits of the integer part and the decimal part.
If the formatting string contains only # to the left of the symbol, numbers less than 1 start with the decimal separator (0 is omitted for units). To display the initial 0 with decimal numbers, use the 0 symbol as the first digit placeholder to the left of the separator.
The (.) Character represents only a separator placeholder in the formatting string. The character actually displayed as a decimal separator in the formatted string depends on the system location settings. The character (.) Is used independently of the set local decimal separator: the formatted string will appear in the correct local format.

 

(%)

Percent placeholder. Multiply the value by 100 and insert the % character at the position where that character appears in the formatting string.

 

(,)

Placeholder of the thousands separator. The thousands separator separates the number of thousands from the number of hundreds into a number with four or more whole digits.

The standard use of the thousands separator provides that the thousands separator is inserted, in the formatting string, between digit placeholders (0 or #).

If the thousands separator is instead placed immediately to the left of the decimal separator (regardless of whether decimal place markers have been inserted) or is inserted as a character to the far right of the formatting string, this tells the system to scale the value by dividing it for 1000 and making the necessary roundings.
For example, the formatting string "## 0 ,." Lets represent 100 million as 100,000. Numbers less than 1000 but equal to or greater than 500 are displayed as 1, while numbers less than 500 are displayed as 0.
Two adjacent thousands separators inserted in the indicated position scale the value by a factor of 1 million, and the scaling factor is increased by 1000 to each immediately adjacent adjacent thousand separator. Multiple occurrences of the thousands separator placeholder inserted in positions different from that indicated and not adjacent provide only instructions for the use of the thousands separator according to standard use.
The character actually used as a thousands separator in the resulting string depends on the system location settings. The character (.) Is used independently of the local thousands separator set: the formatted string will appear in the correct local format.

 

(E- E+ e- e+)

Scientific format indicator (exponential). If the formatting string contains at least one digit placeholder (0 or #) to the left of the character E-, E +, e-, or e +, the number is displayed in scientific format, and E or e are inserted between the number and its decimal exponent.
The number of digit placeholders to the left of the symbol determines the number of digits of the exponent. Use E- or e- to insert the sign - in the case of a negative exponent and no sign in the case of a positive exponent; use E + or e + to insert the sign - in the case of positive exponents and the + sign in the case of positive exponents.
For formatting to work properly, the formatting string must contain the necessary digit placeholders to the right of the symbol.

 

- + $ ( )

Literal characters. These characters are displayed exactly as entered in the formatting string. To display another character, not included among those listed, you must precede it with a backslash (\) or enclose it in double quotes ("").


(\)

Functional inhibitor. Displays the immediately following character in the formatting string exactly as it is written, ignoring its symbolic meaning. The character (\) is not displayed. This writing is equivalent to enclosing the character in double quotes (""). To display the backslash character (\) enter two (\\).

Examples of characters that can not be displayed if not preceded by the backslash are: the formatting characters of date and time (a, c, d, h, m, n, p, q, s, t, w, y, /, :), the numeric formatting characters (#, 0,%, E, and, comma and period), and the string formatting characters (@, &, <,>,!).

 

("…")

The characters enclosed in double quotes are displayed exactly as entered, ignoring their symbolic meaning, exactly as they are for characters preceded by (\).

 

Examples:

 

Format

Express.

Result

000.00

ITEM1

1234,12

while ITEM1 =1234,123

 

1234,57

while ITEM1=1234,567

 

012,30

while ITEM1 = 12,3

 

###.##

ITEM1

1234.12

while ITEM1 =1234,123

 

1234.57

while ITEM1=1234,567

 

12,3

while ITEM1 = 12,3

 

###.00

ITEM1

1234.12

while ITEM1 =1234,123

 

1234.57

while ITEM1= 1234,567

 

12,30

while ITEM1 = 12,3

 

,25

while ITEM1 = 0,25

 

 

##0.00

ITEM1

1234.12

while ITEM1 =1234,123

 

1234.57

while ITEM1=1234,567

 

12,30

while ITEM1 = 12,3

 

0,25

while ITEM1 = 0,25

 

 

 

« Back to Numeric values formatting

« Back to Top

 

 

String formatting

 

The syntax described in this chapter is applicable to fields that return an alphanumeric value or a numeric value to be treated as a text string. The format string can be composed using the formatting characters shown below.


 

 

Character

Description

 

@

Placeholder of character. Display a character or a space. If the string has a character in the position corresponding to that of @ in the formatting string, the character is displayed. Otherwise, a space is displayed in that position.
Placeholders are filled in from right to left unless the formatting string contains the special character (!).

 

&

Placeholder of character. Display a character or nothing. If the string has a character in the position corresponding to & in the formatting string, the character is displayed. Otherwise, nothing is displayed in that position.
Placeholders are filled in from right to left unless the formatting string contains the special character (!).

 

Force string conversion to lowercase

 

Force string conversion to uppercase

 

!

Force compilation from left to right of placeholders (by default the placeholders are filled in from right to left).


 

Examples:

 

Format

Express.

Result

@@@@@

ITEMTX

<4 spazi>A

while ITEMTX= “A”

 

ABCDEF

while ITEMTX= “ABCDEF”

 

!@@@@@

ITEMTX

A<4 spazi>

while ITEMTX= “A”

 

ABCDEF

while ITEMTX= “ABCDEF”

 

&&&&&

ITEMTX

A

while ITEMTX= “A”

 

ABCDEF

while ITEMTX= “ABCDEF”

 

> 

ITEMTX

ABCD

while ITEMTX = “abcd”

 

< 

ITEMTX

abcd

while ITEMTX = “ABCD”

 

 

« Back to Top