Skip to main content
Skip table of contents

f$DateFormat (f$DatumsFormat)


f$DateFormat (f$DatumsFormat)

Convert a given date into another format. The result is a date in the form of a string. If the entry date consists solely of a number, it is interpreted as a time. Four-digit numbers are interpreted as hours and minutes, other numbers as hours.

If the entry date is invalid, an error string is returned.

Format details are to be entered as strings with fixed components and code letters beginning with %. The following code letters are possible:

%a

Abbreviated name of the day of the week (e.g. Mon)

%A

Name of the day of the week (e.g. Monday)

%b

Abbreviated name of the month (e.g. Jan)

%B

Name of the month

%c

Date with time in the country’s settings

%d

Day of the month (01 – 31)

%H

Hour (00 – 23)

%j

Day of the year (001 – 366)

%m

Month in digits (01 – 12)

%M

Minute (00 – 59)

%S

Second (00 – 59)

%w

Day of the week in digits (0 – 6; Sunday is 0). As the formatting is done using a Windows function, the method of counting unfortunately cannot be changed.

%x

Date without time in the country’s settings

%y

Year in two digits

%Y

Year in four digits

%%

Percent symbol


Syntax:

Syntax:

Date = f$DateFormat(Date,Format)


Argument

Type

Meaning

Date

String

Given date

Format

String

Format string for managing the output date

Result:

String

New date created

Example:

Date = f$DateFormat(’01.01.2004’,’ %d.%b.%Y %A ’)

Result: date = ’ 21.Jan.2004 Wednesday ’


If multiple country settings are used, the formats can be customized accordingly.

Example:

Date format = f$ReadRegValue( ’HKEY_CURRENT_USER\\Control Panel\\International\\sShortDate’ )

Dateb = f$Date( DateFormat )
DateFormat = f$replace( DateFormat , ’yyyy’ , ’%Y’ )
DateFormat = f$replace( DateFormat , ’yy’ , ’%y’ )
DateFormat = f$replace( DateFormat , ’dd’ , ’%D’ )
DateFormat = f$replace( DateFormat , ’MM’ , ’%m’ )
DateFormat = f$replace( DateFormat , ’d’ , ’%D’ )
DateFormat = f$replace( DateFormat , ’M’ , ’%m’ )
DateFormat = f$replace( DateFormat , ’%D’ , ’%d’ )
Dateb = f$DateFormat( Dateb ,DateFormat )


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.