Home > front end >  convert datetime datetime to numpy int64 python
convert datetime datetime to numpy int64 python

Time:10-07

How do I convert type datetime.datetime to type numpy.int64 ? I have 44346 days, 0:00:00 but I want 44346

data_r = xlrd.xldate_as_datetime(int(data_calcolo), 0).date()
    y = data_r.month
    a= data_r.year
    if k > 12 :
       k= k-12
       y =y-k
       a = a-1  
    data_nuova=datetime(a, y, 1)
    z=datetime(1900, 1, 1)
    f=(data_nuova-z)

CodePudding user response:

Subtracting two datetime.datetime objects (i.e., data_nuova-z) returns a datetime.timedelta object.

If you just want the number of days in that difference, then you can access it using f.days and then cast that integer to an np.int64 object.

CodePudding user response:

sorry, maybe I expressed myself badly, I have 01/06/2021

but I need the corresponding number in excel 44348

  • Related