Tuesday, January 5, 2016

TODAY vs WORKDATE

What is the different between TODAY vs WORKDATE ? To find out the difference between the two options I have written a small codeunit and it only contain following two lines.
1:  MESSAGE('Work Date: %1',WORKDATE);  
2:  MESSAGE('Today : %1',TODAY);  
I first execute the codeunit and it gives me following values as output. 
No difference in the values and it gives me the current date as the output. So I went ahead and change the work date of the Dynamics NAV for particular session and then execute the codeunit for the second time. 

This time output messages got changed with the work date and today message box still provide me the server date. 

Summary : Dynamics NAV take the work date from the session work date and today is taken from the server date. 

Following is the MSDN definitions,
Today : Returns the current date set in the operating system. (You can only use the TODAY function to retrieve the current date from the operating system. You cannot use it to set the date in the operating system.)

Work Date : Sets and returns the work date for the current session. (This function returns the work date chosen using the Work Date option on the Tools menu. If the user did not choose a work date, the the current system date is returned.)

Please provide your feedback with a comment.
Thank you and Regards,
Tharanga Chandrasekara

No comments:

Post a Comment