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=126.96.36.199, Culture=neutral, PublicKeyToken=b77a5c561934e089′