# How to merge separate date and time to @timestamp

**URL:** https://discuss.elastic.co/t/how-to-merge-separate-date-and-time-to-timestamp/132545
**Category:** Logstash
**Created:** [May 19, 2018, 12:23am UTC](https://discuss.elastic.co/t/how-to-merge-separate-date-and-time-to-timestamp/132545 "2018-05-19T00:23:00Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jiona](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@jiona](https://discuss.elastic.co/u/jiona)
#### Post date: [May 19, 2018, 12:23am UTC](https://discuss.elastic.co/t/how-to-merge-separate-date-and-time-to-timestamp/132545/1 "2018-05-19T00:23:00Z")

</div>

Hi all.  
I parse a csv with date and time events. These events has no syslogtime. They are separated in to date and time.  
How can I merge date and time to the @timestamp?  
I tried some samples with "mutate" and "date" I had found in the forum but without success.

Thats my "rubydebug"

> "StartTime" =\> "18:32:27",  
> "StartDate" =\> "16.05.2018",  
> "@timestamp" =\> 2018-05-19T00:06:28.173Z,"

Kind regards - Jiona

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [May 19, 2018, 2:45pm UTC](https://discuss.elastic.co/t/how-to-merge-separate-date-and-time-to-timestamp/132545/2 "2018-05-19T14:45:41Z")

</div>

```
mutate { add_field => { "[@metadata][ts]" => "%{StartDate} %{StartTime}" } }
date { match => ["[@metadata][ts]", "dd.MM.YYYY HH:mm:ss" ] }
```

---

<div class="post-metadata">

### Author: ![jiona](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@jiona](https://discuss.elastic.co/u/jiona)
#### Post date: [May 22, 2018, 8:47pm UTC](https://discuss.elastic.co/t/how-to-merge-separate-date-and-time-to-timestamp/132545/3 "2018-05-22T20:47:58Z")

</div>

Hello Badger.  
I'm sorry for my late response (was in holiday).  
Your suggestion is the right way, but the time in @timestamp is two hours before. Do you have a solution for that, or can you show me where I can find detailed information about "metadata" and there options?

> "StartTime" =\> "18:32:27",  
> "StartDate" =\> "16.05.2018",  
> "@timestamp" =\> 2018-05-16T16:32:27.000Z,

Kind regards - Jiona

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [May 22, 2018, 8:49pm UTC](https://discuss.elastic.co/t/how-to-merge-separate-date-and-time-to-timestamp/132545/4 "2018-05-22T20:49:39Z")

</div>

@timestamp is always UTC. If your logs are not in UTC then specify the [timezone](https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html#plugins-filters-date-timezone) option on the date filter.

---

<div class="post-metadata">

### Author: ![jiona](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@jiona](https://discuss.elastic.co/u/jiona)
#### Post date: [May 22, 2018, 8:51pm UTC](https://discuss.elastic.co/t/how-to-merge-separate-date-and-time-to-timestamp/132545/5 "2018-05-22T20:51:41Z")

</div>

Thank's. I will be back soon.

---

<div class="post-metadata">

### Author: ![jiona](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@jiona](https://discuss.elastic.co/u/jiona)
#### Post date: [May 23, 2018, 12:05am UTC](https://discuss.elastic.co/t/how-to-merge-separate-date-and-time-to-timestamp/132545/6 "2018-05-23T00:05:27Z")

</div>

In "Kibana =\> Management =\> Advanced Settings =\> dateFormat" the time zone will default recognized by the browser - or can changed to the required [Joda.org](http://Joda.org) time zone page.  
For me, I do not need to change the timezone.

Thats the "rubydebug" output:

> "@timestamp" =\> 2018-05-16T16:32:27.000Z,  
> "CallId" =\> "206522"  
> "StartTime" =\> "18:32:27",  
> "StartDate" =\> "16.05.2018",

Thats from Kibana output:

> @timestamp May 16th 2018, 18:32:27.000  
> CallId 206522  
> StartDate 16.05.2018  
> StartTime 18:32:u5272:

@Badger - Thanks for your support.  
Kind regards - Jiona

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 20, 2018, 12:05am UTC](https://discuss.elastic.co/t/how-to-merge-separate-date-and-time-to-timestamp/132545/7 "2018-06-20T00:05:31Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
