What is the best way to put a date in my template?

What is the best way to put a date in my template?

This article has been machine translated. If you find any errors, we would be grateful if you could report them to translation@timesensor.com.

There are different ways to include a date in your template. This entry shows how the different variants differ. It is assumed that you are familiar with creating templates. Otherwise, please study the videos in the corresponding section.

4D Ausdruck einfügen

Option 1: Insert date fields

Of course you can insert a 4D database field directly into your template. In the insertion dialogue you have the possibility to influence the display:
However, inserting a field into your template becomes a disadvantage if you want to print templates in foreign languages. The database will return the date in the language of the operating system.

Option 2: Use UTI_GetLetterDate

You can use the UTI_GetLetterDate function. Since you can give the language as the first argument to this function, the date will be returned in the corresponding language (the month name will be written out). With only one argument, the current date is returned. As an (optional) second argument, a database field can be passed. For example, you can have the invoice date output in the desired language.

Option 3: Use GEN_INSERT

The expression "GEN_INSERT" allows you to insert place and date. The first argument determines which date should be used:
letterdate returns the date of the record (i.e. the underlying invoice, for example).
currentdate returns the current date
As a second argument you can specify a language code, e.g. de, fr, en, etc.

Comparison

The following list shows the different expressions and the result achieved (here using the example of an English-language template).