Monsieur Winner

MS D365FO || Monsieur D365FO

Technical

Remove days from Date in D365FO

Bonjour,

In this short article, we will see how we could remove days from a date in D365FO. c’est à dire change 31-01-2022 to 01-202.


public static void main(Args _args)

   {

       TransDate   myDate = today();// Date to be converted to String
       str         dateString; // variable to hold the converted date
       str         trimedDate;
       dateString = date2Str(myDate,231,
       DateDay::Digits2,
       DateSeparator::Hyphen, // separator1
       DateMonth::Digits2,
       DateSeparator::Hyphen, // separator2
       DateYear::Digits4
           );

       trimedDate = subStr(dateString,1,7);

       info(strFmt("%1",dateString));

       info(strFmt("%1",trimedDate));

   }

admin

Komi Siabi is a Bilingual D365FO Solution architect who loves sharing his knowledge as he works on Both Francophone and Anglophone projects around the globe. He enjoys doing some tiktok videos in his leisure time.

Leave a Reply

Your email address will not be published. Required fields are marked *