I have unix timestamps that starts from 1970-01-01 in csv file as column. I want their corresponding date-time but when I am using  pd.to_datetime() I am getting date something like this: 1970-01-16 20:55:29.694.
            Asked
            
        
        
            Active
            
        
            Viewed 972 times
        
    -2
            
            
         
    
    
        Sreeram TP
        
- 11,346
- 7
- 54
- 108
- 
                    `datetime.datetime` ? – Vineeth Sai Sep 25 '18 at 06:31
- 
                    2Possible duplicate of [Converting unix timestamp string to readable date](https://stackoverflow.com/questions/3682748/converting-unix-timestamp-string-to-readable-date) – Bollehenk Sep 25 '18 at 06:33
- 
                    What is the output that you are expecting.? – Sreeram TP Sep 25 '18 at 06:44
1 Answers
0
            
            
        From your affirmation, I will assume that you want to extract something specific (let's keep it in the same format) from the output of pd.to_datetime() or use another pandas function.
If this is the case, I would proceed as follows :
    import pandas as pd
    t = '2018-07-25' # your excel date
    t_ex = pd.Timestamp(t) 
    # t_ex == 2018-07-25 00:00:00
    t_ex_format = m = str(t_ex.year)+'-'+str(t_ex.month)+'-'+str(t_ex.day) 
    # t_ex_format = 2018-07-25
 
    
    
        FlyingZipper
        
- 701
- 6
- 26
- 
                    Thanks for the answer. Sorry I didnt asked my question properly. I have a column of timestamp which has unix timestamps( eg. 1364099483). I want to convert this to its corresponding date-time which should is 24 March 2013 04:31:23. But the result which I am getting is 1/16/1970 18:54. Code which I am using for this is: dataset['DATE']=(pd.to_datetime(dataset['timestamp'],unit='ms')) – Saurabh Singh Sep 25 '18 at 16:01
- 
                    
