How to convert Julian data to Calendar date in UiPath

Hi,

I want to convert Julian date to Calendar date in UiPath, specially through assign activity.
Anyone knows how to convert it?

For e.g. I have Julian date : 118072 and it’s calendar value is 13-03-2011 00:00.

Any help would be appreciated.

Thanks,
Shantanu

Hi!

try this

Regards,
NaNi

Hi THIRU_NANI, could you please elaborate more? I’m not getting it, its just Class, but how to use it? an explanation through example would be great help. :slight_smile:

Hi

Hope the below steps would help you resolve this

  1. Say you have your input in a string variable named Strinput

  2. Now use a assign activity like this

int_date = 2000+Convert.ToInt33(Strinput.Substring(1,2))

Int_date is of type int32

  1. One more assign activity

int_year = Convert.ToInt32(Strinput.Substring(4))

  1. Then final assign activity like this

stroutput = Datetime(int_year,1,1).AddDays(int_date-1).ToString(“dd-MM-yyyy hh:mm”)

Cheers @Shantanu_More1

Hi Palaniyappan,
I’m trying your solution. But it’s saying “ToInt33 not a member of system.convert”? even though int_date is set to int32. How to resolve this?

Oh sorry that’s a typo
It’s ToInt32

@Shantanu_More1

Yeh, and one more typo, int_days should be int_date right?

and I have made variable strouput as System.DateTime. But I’m getting error : ‘Datetime’ is type and can’t be used an expression. For the last assign activity.

That’s right my bad
Refer this

Where stroutput is variable of type string
Not Datetime

@Shantanu_More1

Hi, I’m using stroutput as a ‘string’ but the same error. Could you please advise?

Not able to find AddDays in expression.

In case if you have zip file of working code, please share.

Thanks,
Shantanu

1 Like

Aah got it

We need to add New before Datetime like this

stroutput = New Datetime(int_year,1,1).AddDays(int_date-1).ToString(“dd-MM-yyyy hh:mm”)

Stroutput is string variable

Cheers @Shantanu_More1

Hi, I tried this, now it’s not showing any error, but it’s giving wrong output.(wrong calendar date)
I have attached the zip file of the code for your reference.
I have taken julian date as "118072 " and it’s calendar date it coming as “10-07-0077 12:00”.

Thanks,
Shantanu

JuliantoCalendar.zip (2.2 KB)

Hi,
You able to debug my code?
Given approach giving wrong result.

@Parth_Doshi @Pablito @loginerror

If you have any idea, please assist.

Thanks,
Shantanu

Dear @Palaniyappan ,

I have similar issue and tried the output as mentioned above in the above conversation.

I have the dates in the excel column as show in screen shot below. When I check the format it is in custom and in en-US format.

image

When I read range then the date get converted to a number.

Ex: 24-Jan-2022 equivalent number in data table is 44585

This is the output that I received

image

Appreciate your feedback as always.

Regards,
Manjesh

@manjesh_kumar
looks more like an OADate
grafik

1 Like

Dear Peter,

Thank you it is working. :clap:

Regards,
Manjesh

I recently came across the scenario, Placing the solution for reference.

  1. Assign a Int32 variable (Eg: JulianDate) with your Julian date value (Eg: 2460473)
    JulianDate = 2460473

  2. Assign a Datetime variable ( Eg: DTDateTime)
    DTDateTime = DateTime.MinValue.AddDays(julianDate - 1721425.5)

  3. Assign a string variable (Eg: Output) or any of your required format.
    Output = DTDateTime.ToString(“MM/dd/yyyy”)

Input - 2460473
Output - 06/11/2024