# Create a new DateTime dataframe column from Date and Time columns

**URL:** <https://discourse.julialang.org/t/create-a-new-datetime-dataframe-column-from-date-and-time-columns/129406>\
**Category:** General Usage\
**Tags:** dataframes, datetime\
**Created:** [May 28, 2025, 12:50pm UTC](https://discourse.julialang.org/t/create-a-new-datetime-dataframe-column-from-date-and-time-columns/129406 "2025-05-28T12:50:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ju\_ska](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@Ju\_ska](https://discourse.julialang.org/u/Ju_ska)\
**Post date:** [May 28, 2025, 12:50pm UTC](https://discourse.julialang.org/t/create-a-new-datetime-dataframe-column-from-date-and-time-columns/129406/1 "2025-05-28T12:50:15Z")

</div>

Hi,

(sorry for the pedantic syntax…)

```julia
using DataFrames
using Dates

df = DataFrame(DATE=[Date("2025-01-01","yyyy-mm-dd"), Date("2025-01-01","yyyy-mm-dd"), Date("2025-01-02","yyyy-mm-dd")], TIME=[Time("00:00:00"), Time("12:00:00"), Time("00:00:00")])

```

gives

```julia
3×2 DataFrame
 Row │ DATE TIME     
     │ Date Time     
─────┼──────────────────────
   1 │ 2025-01-01 00:00:00
   2 │ 2025-01-01 12:00:00
   3 │ 2025-01-02 00:00:00

```

So I would like to create a third column with the full datetime stamp.  
(In general) I struggle with the online creation of a dataframe column…  
Any help welcome.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [May 28, 2025, 12:55pm UTC](https://discourse.julialang.org/t/create-a-new-datetime-dataframe-column-from-date-and-time-columns/129406/2 "2025-05-28T12:55:35Z")

</div>

You mean like this?

```julia
julia> df = DataFrame(DATE = [Date(2025), Date(2025), Date(2025, 1, 2)], TIME = [Time(0), Time(12), Time(0)])
3×2 DataFrame
 Row │ DATE TIME
     │ Date Time
─────┼──────────────────────
   1 │ 2025-01-01 00:00:00
   2 │ 2025-01-01 12:00:00
   3 │ 2025-01-02 00:00:00

julia> df.dt = DateTime.(df.DATE, df.TIME); df
3×3 DataFrame
 Row │ DATE TIME dt
     │ Date Time DateTime
─────┼───────────────────────────────────────────
   1 │ 2025-01-01 00:00:00 2025-01-01T00:00:00
   2 │ 2025-01-01 12:00:00 2025-01-01T12:00:00
   3 │ 2025-01-02 00:00:00 2025-01-02T00:00:00

```

(first line just included to suggest an easier way to construct Dates/Times)

---

<div class="post-metadata">

**Author:** ![Ju\_ska](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@Ju\_ska](https://discourse.julialang.org/u/Ju_ska)\
**Post date:** [May 28, 2025, 1:02pm UTC](https://discourse.julialang.org/t/create-a-new-datetime-dataframe-column-from-date-and-time-columns/129406/3 "2025-05-28T13:02:21Z")

</div>

Incredibly simple !  
Thanks a lot !
