Get Complete Date Format : MM/DD/YYYY

Dears,

Based on Some inputs in Excel : Month, Day, and Year as strings, I want to get the Complete Date Format as follows : MM/DD/YYYY
image

Hi.

Take a look at some online sources, such as this one: https://docs.microsoft.com/en-us/dotnet/api/system.datetime.-ctor?view=netframework-4.8

I think you just need to construct the date with each value.
Let’s assume you use an Excel Read Range and a ForEach to process each row. It might look like this:

For each row in dt1
    Assign activity: row("Date") = (new DateTime(CInt(row("Year").ToString),CInt(row("Month").ToString),CInt(row("Day").ToString))).ToString("MM/dd/yyyy")

Excel Write Range

Note: I didn’t test this.

The part of .ToString(“MM/dd/yyyy”) is just so you can format it the way you want and uses similar formatting as you see in Excel Format Cell options.

I hope this helps.

Regards.

1 Like

Hi @hsendel,

Canyou check the attach file. I hope this helps,
ExcelData.zip (19.1 KB)

Regards.

2 Likes

Thanks Jyotika. Well Done :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.