How to determine date format on D365BC


How do you display the date in your country? Is it 6 Dec 2021? Is it Dec 6, 2021 or 2021/12/6? If you are American, it will be Dec 6, 2021, if you are European, you are familiar with the order 6 Dec 2021, and if you are Japanese like me or Chinese, it will be 2021年12月6日 or 2021/12/6.
Wikipedia shows that different countries use different date formats.
Date format by country – Wikipedia

How do BC control these date formats? That is the topic of this blog post.

The date format control logic has been changed in v19.1 of BC. To sum up, it is now “completely language dependent”. So, how it was before v19.0, I’ll explain later in this blog post.

I have prepared two environments, one for v19.1 and one for v19.0. ( The image below shows three environments, but I’ll use two of the Sandbox ones.) In both environments, the Country/Region is US, which makes a bit of sense.

I will start with the date format of v19.1 and use the data on Cronus Company. I use a purchase order.

Open and print the following purchase order.

When I preview the purchase order form, the date will be shown as April 9, 2021. The order is month, day, year. The month is displayed in text format (ex. April) , not as a number (ex. 4) , and the date format according to Excel formatting is “mmmm d, yyyy”.

Americans may not feel strange about this order, but it is actually a minority around the world that displays the month first. In other parts of the world, such as Europe, it is common to put the day first. I’m Japanese, and most Japanese people don’t know the exact difference in the order between Europe and the U.S., so I don’t feel any special feeling of strangeness. By the way, In Japan, the order is year, month, day. I found out that China also uses this order.

The reason why the month is displayed first is because the Language in My Settings is set to “English (United States)” as default. This is because the Region of the Environment is US.

Let’s change the Language. For example, change it to French.

The date was displayed as 9 avril 2021. The order is French style, with the date at the beginning. In Excel’s representation, the format is “d mmmm yyyy”.

Try changing the Language to “English(United Kingdom)”.

When I preview the order form again, it shows 09 April 2021. The month text has been replaced by English instead of French. Other than that, the date has a zero for padding. I am not sure if it is common in the UK to have zeros for padding and in France not to have zero padding, but you can see that the formatting is different between French and English (UK) on the BC. The Excel expression for the format would be “dd mmmm yyyy”.

By the way, if you set the Language to Japanese, it will be displayed as follows. The order is Year, Month, Day. For those of you who don’t read Kanji, the Kanji after 2021 represents Year, the Kanji after 4 represents Month, and the Kanji after 9 represents Day. (I hope this kanji charactors are not garbled…)

As you can see, v19.1 seems to be Language dependent for the date format. Let’s take a more detailed look. Try printing a Sales Quote with the same v19.1.

Open and print the Sales Quote.

The language in My Settings is set to “English (United Kingdom)”.

The print preview shows April 2, 2021. I have set the language to English (United Kingdom), but the month is displayed first. Why is this?

It has to do with the language of the sales quote, if you press Ctrl+Alt+F1 in the card page of Sales Quote, you will activate the page inspector. If you search for the keyword “Lang”, you will find that Language exists as a hidden field in the Sales Quote header, and the value is “ENU”, where ENU is English (United States). So it will be displayed in the US format “mmmm d, yyyy”.

Let’s change the language of the Sales Quote by adding a Language Code field to the Sales Header in the Personalize function.

Then change it to FRA (French).

The print preview shows 2 avril 2021. This is the French style date format.

In other words, the date format is Language dependent, and the Language setting of the Sales/Purchase Order takes the priority over the Language of the My Settings.

So, does Region matter? In My Settings, the Region tooltip says that it specifies the date format.

In fact, before v19.0, Region had an effect on the date format. From now on, I will use the v19.0 environment that I have prepared.

As in v19.1, use the same Sales Quote from Cronus Company. And add a Language Code field to the Sales Quote header as in v19.1.

In My Settings, set Region to English (United States) and Language to English (United Kingdom).

Set the language of the Sales Quote to FRA (French).

The print preview shows avril 2, 2021. The language used to display the months is French, but the month is at the top of the date. In other words, the order of the year, month, and day is US style.

Let’s change the Region to French, and leave the Language as English (United Kingdom).

The date was displayed as 2 avril 2021. The day is displayed first, so the order of the year, month, and day is French Style.

Just to be sure, let’s try another case: In My Settings, change Region to English (United Kingdom).

The date is now displayed as 02 avril 2021. It’s almost the same as before, but with a zero for padding day. In other words, it’s not French style, but UK Style.

In summary, here’s how it works:
・v19.1 : Date format is Language dependent. Language on Sales/Purchase Order overrides the Language in My Settings.
・Before v19.0 : Date format is Region dependent. Month display language (April/avril) is Language dependent.

However, I was talking to a developer who has been working on NAV/BC for almost 20 years since the NAV days, and he said that NAV was originally completely language dependent. As far as I can confirm, BC v16.5 is Region dependent.

I don’t know when it became Region-dependent and why it became Region-dependent and then became Region-independent, but it is a fact that it became completely Language dependent at least from v19.1, so I introduced it.

Thanks for your reading.

返信を残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です