# Convert DataFrame timestamp column to Data Type and split Date and Hour

**URL:** <https://discourse.julialang.org/t/convert-dataframe-timestamp-column-to-data-type-and-split-date-and-hour/48270>\
**Category:** General Usage\
**Tags:** question, dates, dataframes, convert\
**Created:** [October 13, 2020, 1:55am UTC](https://discourse.julialang.org/t/convert-dataframe-timestamp-column-to-data-type-and-split-date-and-hour/48270 "2020-10-13T01:55:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnFlorez25](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnflorez25/32/18621_2.png) [@JohnFlorez25](https://discourse.julialang.org/u/JohnFlorez25)\
**Post date:** [October 13, 2020, 1:55am UTC](https://discourse.julialang.org/t/convert-dataframe-timestamp-column-to-data-type-and-split-date-and-hour/48270/1 "2020-10-13T01:55:08Z")

</div>

Hello everybody, I need to Convert DataFrame timestamp column to Data Type and split Date and Hour, I have this column:

 ![Screen Shot 2020-10-12 at 8.50.53 PM](https://global.discourse-cdn.com/julialang/original/3X/9/4/944f7e7b31be2b007b04d3a9ffa486d1248508b6.png)  
I try to use the function `unix2datetime(x)` but I don’t know how we can do with a column in a DataFrame, I try the next line of code:

```julia
eventsDataFrame[!,[:timecreated]] = convert.(unix2datetime(eventsDataFrame[!,[:timecreated]]))

```

Then, I need to convert to Date formant and split into two news columns wit the Date and the Hour.

Thanks for your help

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [October 13, 2020, 2:01am UTC](https://discourse.julialang.org/t/convert-dataframe-timestamp-column-to-data-type-and-split-date-and-hour/48270/2 "2020-10-13T02:01:44Z")

</div>

Don’t index the data frame with a vector, use `df[!, :timecreated]` instead of `df[!, [:timecreated]]`.
