# How to represent Date Values in ML datasets

Many times we encounter data sets with date values as one of the feature to handle in machine learning problems (e-g historical data of share prices of a company over the period of time, with date as one feature).

One of the way to represent dates in ML datasets is converting it to equivalent numerical representation. I usually convert dates to unix timestamp value to handle better with numerical calculation in ML algorithms.

Excel have a easy way to convert cell value to unix time stamp. Excel stores dates internally as number of days since January 1, 1900.

In order to convert we can use the following formula

=(CellValue-DATE(1970,1,1))*86400