Covert 365 days to ddmmyy

Hi all,

Let say I have a txt file contains a list of number

I use substring to take no.345, which is equal to 11 dec.

How can I convert 345 to 11 dec?

Many thanks

  1. Take a DateTime variable in an Assign statement:
    eg. tempDate=new DateTime(DateTime.Today.Year,1,1)

  2. Then to get the date from your number of days (we’ll call it dayOfYear) scraped from your file:
    requiredDate= tempDate.AddDays(dayOfYear-1)

Thank you very much! It works!
But it change to this year, is it possible to calculate let say 2020? Many thanks.

Yes. Change the statement to tempDate.AddYears(1).AddDays(dayOfYear-1).

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