convert date to number python
Question: > **Possible Duplicate:**  
>  [Fetching datetime from float and vice versa in
> python](http://stackoverflow.com/questions/6706231/fetching-datetime-from-
> float-and-vice-versa-in-python)

Like many people I switched from `Matlab` to `Python`. `Matlab` represents
each date as a number. (`Integers` being days since `00-00-0000`, and
fractions being time in the day). I believe that `python` does the same except
off a different start date `0-0-0001`

I have been playing around with `datetime`, but cant seem to get away from
`datetime` objects and `timedeltas`. I am sure this is dead simple, but how do
I work with plain old numbers (floats)?

perhaps as a bit of context:

i bring in a date and time stamp and concatenate them to make one time value:

    
    
    from datetime import datetime
    date_object1 = datetime.strptime(date[1][0] + ' ' + date[1][1], '%Y-%m-%d %H:%M:%S')
    date_object2 = datetime.strptime(date[2][0] + ' ' + date[2][1], '%Y-%m-%d %H:%M:%S')
    


Answer: Try this out:

    
    
    import time
    from datetime import datetime
    
    t = datetime.now()
    t1 = t.timetuple()
    
    print time.mktime(t1)
    

It prints out a decimal representation of your date.

