# Extracting parts of different timestamp fields

**URL:** https://discuss.elastic.co/t/extracting-parts-of-different-timestamp-fields/214915
**Category:** Logstash
**Created:** [January 13, 2020, 11:11pm UTC](https://discuss.elastic.co/t/extracting-parts-of-different-timestamp-fields/214915 "2020-01-13T23:11:29Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Peter\_Li](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/peter_li/32/109125_2.png) [@Peter\_Li](https://discuss.elastic.co/u/Peter_Li)
#### Post date: [January 13, 2020, 11:11pm UTC](https://discuss.elastic.co/t/extracting-parts-of-different-timestamp-fields/214915/1 "2020-01-13T23:11:29Z")

</div>

I have many timestamp fields:  
AdmitDateTime  
DCDateTime  
etc.

I want to pull out the yyyy, MM, dd parts individually from them, eg

copy =\> {  
"AdmitDateTime" =\> "@timestamp"  
}  
add\_field =\> {  
AdmitYear =\> "%{+yyyy}"  
AdmitMonth =\> "%{+MM}"  
}  
copy =\> {  
DCDateTime =\> "@timestamp"  
}  
add\_field =\> {  
DCYear =\> "%{+yyyy}"  
DCMonth =\> "%{+MM}"  
}  
etc.

Unfortunately, the %{+\<format\>} like "%{+yyyy}" will only work on @timestamp field, not on any other fields.  
Is there a shorthand, like "%{\<field\>+\<date format\>}", e.g. "%{AdmitDateTime+yyyy}" ?

Thanks

---

<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: [January 13, 2020, 11:30pm UTC](https://discuss.elastic.co/t/extracting-parts-of-different-timestamp-fields/214915/2 "2020-01-13T23:30:10Z")

</div>

> [@Peter\_Li](#):
>
> Is there a shorthand, like "%{+}", e.g. "%{AdmitDateTime+yyyy}" ?

No, there is not.

---

<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: [February 10, 2020, 11:30pm UTC](https://discuss.elastic.co/t/extracting-parts-of-different-timestamp-fields/214915/3 "2020-02-10T23:30:15Z")

</div>

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