Dates. What a nightmare. Day/Month/Year? Month/Day/Year? 24 hour time? 12 hour time? It’s almost enough to make you sympathetic to the idea of decimal time…almost.
Opinion is split over Power BI’s ability to automatically create Date hierarchies in your model. Personally it drives me mad and I always turn it off, but I know a lot of people love the convenience of it. Whatever your feelings, though, it is important to be aware of the problems it can cause with the size of your model.
Calculating exact Day, Time, No of Month in a Day, Number of days in a Year, Day of the Week and many more has always been a challenging point while writing code in NAV. Though you can manage to achieve this but anyhow you end up with many lines of code. But just twisting your code a little bit with some DotNet variable will bring you a broad smile in your face with just a single line of codes. For an example have a look into the below screenshot.
For a recent project, I needed to export the object properties of a number of objects to an XML file.
As you know, in the Object table, there are separate columns for Date and Time. Initially, I exported each column as an individual XML attribute, using the FORMAT function’s standard format #9 to XML-format the values