Handle DateTime – Use DotNet Variable


Hey Friends,

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.


Just have a look on the above piece of code. Outcome is exactly the same what you are thinking. And here is the output


Below is the description of the DotNet Variable used for the above case. I will recommend each and everyone to have a look on this and explore as it consists of a lot of Methods which can be of great help to you in your daily life as a NAV Programmer.

DotNetDateTime – DotNet – System.DateTime.’mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089′

Append String – Use DotNet Variable


Hey Everybody,

As a Developer there many scenario comes up where we need to append a text value. This kind of needs do comes up when we need to maintain a certain string length. As a common NAV Developer we use to write the below piece of code.


Replacing the above piece of code with some DotNet variable will literally make you shock as far as the Performance  & Optimization is concerned. Have a look on the below code.


If you will calculate the Time taken by the above piece of codes then you will find that the second is 5 to 10 times faster then the first one. For e.g if First one takes 49 Sec 256 Milliseconds then the Second one will take just around 20 Milliseconds.

StringBuilder – DotNet – System.Text.StringBuilder.’mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089′