Dhan API - converting start_Time to IST in python

Can someone please help with python code to convert start_Time that we get from daily_minute_chart API to relevant timestamp?

Hey @pahadi_trader

You can take reference from the below snippet which should help you convert to datetime.

def ConvertToDateTime(JulianDate):
    Dt1980= datetime(year=1980,month=1,day=1,hour=5,minute=30)
    DtObj= Dt1980+ timedelta(seconds=JulianDate)
    return DtObj

Hope this helps! Will soon add this on Documentation as well.

1 Like

Thanks. This is working.

1 Like

@pahadi_trader @Hardik can you share the code snippet, I am still not able to convert start_Time list to datetime

I am getting start_Time as list of float

Hello @nidhichauhan17

Welcome to Dhan Community. Great to see you our APIs!

Can you please tell me what is the exact response you are getting here and whether the date is in Julian or not, so that we can assist you accordingly!

Hi, I’m not able to convert to Readable Datetime in C#. Can you provide the code in converting ‘start_Time’ to readable

Hello @swapna_a

Welcome to MadeForTrade community!

Can you tell me if you are using V1 or V2 of APIs. In case of V1, it is in Julian and you will have to calculate accordingly.