How to convert date format

Hi,

I have date in format “2.1.2018” (d.m.yyyy). Need to get it in this format: “20180102” (yyyymmdd). How can it be done, days and months have to have leading zeros.

Thanks,

-mikko

First you read the date into a DateTime variable, as shown here:

Then you output to string in the format you want (“yyyyMMdd”) like this:

Details: Custom date and time format strings - .NET | Microsoft Learn

Ok, Thanks! I give it try.