# Change 2 date format in a column

**URL:** <https://forum.knime.com/t/change-2-date-format-in-a-column/67475>\
**Category:** KNIME Analytics Platform\
**Created:** [May 25, 2023, 9:27am UTC](https://forum.knime.com/t/change-2-date-format-in-a-column/67475 "2023-05-25T09:27:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![takdirzd](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/t/6a8cbe/32.png) [@takdirzd](https://forum.knime.com/u/takdirzd)\
**Post date:** [May 25, 2023, 9:27am UTC](https://forum.knime.com/t/change-2-date-format-in-a-column/67475/1 "2023-05-25T09:27:51Z")

</div>

hey guys, I want to ask.  
how can I change this format like in the picture, “yyyy.mm.dd” to “dd.mm.yyyy”? there are 2 date format, but i just want to change it in 1 format only.  
 ![gambar](https://forum-cdn.knime.com/uploads/default/original/3X/a/c/ac36c9effcf8a6fff2ecad2ec7deaf6b4f765c83.png)

example, the data is :  
17.01.2022  
2022.04.01  
…  
and I want the output like this,  
17.01.2022  
01.04.2022  
…

thank you

---

<div class="post-metadata">

**Author:** ![gonhaddock](https://forum-cdn.knime.com/user_avatar/forum.knime.com/gonhaddock/32/35425_2.png) [@gonhaddock](https://forum.knime.com/u/gonhaddock)\
**Post date:** [May 25, 2023, 10:07am UTC](https://forum.knime.com/t/change-2-date-format-in-a-column/67475/2 "2023-05-25T10:07:05Z")

</div>

Hello @takdirzd and welcome to the KNIME forum  
A possible one node solution is String Manipulation with the following code:

```auto
string(
	regexMatcher($text$, ".*[.]\\d{4}").equals("True")
	? $text$
	: join(
		substr($text$, 8, 2)
		, "."
		,substr($text$, 5, 2)
		, "."
		,substr($text$, 0, 4)
		)
)

```

[code source](https://forum.knime.com/t/if-or-and-statement-rule-engine/66066/4)

![image](https://forum-cdn.knime.com/uploads/default/original/3X/1/e/1eb7a2807df1377620c2044e3fa2b554bcf38684.png)

Other possible approach would be Column Expressions…  
With some more nodes you would be able to split the data based in a logical condition, modify target data, append back and resort if necessary.

BR

---

<div class="post-metadata">

**Author:** ![denisfi](https://forum-cdn.knime.com/user_avatar/forum.knime.com/denisfi/32/83308_2.png) [@denisfi](https://forum.knime.com/u/denisfi)\
**Post date:** [May 25, 2023, 5:11pm UTC](https://forum.knime.com/t/change-2-date-format-in-a-column/67475/3 "2023-05-25T17:11:26Z")

</div>

Hi guys…

Well you have a date problems, they are shuffle into a unique column, 2 different types.

If you’d like to be more simple, you can use the row split to separate the types A and B and make changes into one of them.

Thanks,

Denis

---

<div class="post-metadata">

**Author:** ![takdirzd](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/t/6a8cbe/32.png) [@takdirzd](https://forum.knime.com/u/takdirzd)\
**Post date:** [May 26, 2023, 3:26am UTC](https://forum.knime.com/t/change-2-date-format-in-a-column/67475/4 "2023-05-26T03:26:13Z")

</div>

wow it works, thank you very much!

---

<div class="post-metadata">

**Author:** ![takdirzd](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/t/6a8cbe/32.png) [@takdirzd](https://forum.knime.com/u/takdirzd)\
**Post date:** [May 26, 2023, 3:27am UTC](https://forum.knime.com/t/change-2-date-format-in-a-column/67475/5 "2023-05-26T03:27:40Z")

</div>

yeah I think the same way. I can split them into 2 types date format, and merge them later. but I think it’s takes much time to do, and there will be a lot of nodes 😄 … thank you!

---

<div class="post-metadata">

**Author:** ![denisfi](https://forum-cdn.knime.com/user_avatar/forum.knime.com/denisfi/32/83308_2.png) [@denisfi](https://forum.knime.com/u/denisfi)\
**Post date:** [May 26, 2023, 10:14am UTC](https://forum.knime.com/t/change-2-date-format-in-a-column/67475/6 "2023-05-26T10:14:32Z")

</div>

Yeap! I suggest to use regular expression for it… simple with string manipulation node:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/d/d/dd89d972eb354f11bfcdf3e4033110608eb1dab9.png)

regexReplace($$CURRENTCOLUMN$$,“(\d{4})\.(\d{2})\.(\d{2})”,“$3.$2.$1”)

I change the order with variables as $1.$2.$3 to $3.$2.$1

Just 1 node for it… and it’s secure because it’ll change if match the expression.

BR,

Denis

---

<div class="post-metadata">

**Author:** ![gonhaddock](https://forum-cdn.knime.com/user_avatar/forum.knime.com/gonhaddock/32/35425_2.png) [@gonhaddock](https://forum.knime.com/u/gonhaddock)\
**Post date:** [May 26, 2023, 1:02pm UTC](https://forum.knime.com/t/change-2-date-format-in-a-column/67475/7 "2023-05-26T13:02:32Z")

</div>

@denisfi you are right, I almost forgot regexReplace() is conditional itself.  
Good catch!! 👍🏼  
`regexReplace($text$, "(\\d{4}).(\\d{2}).(\\d{2})", "$3.$2.$1")`  
BR

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [June 2, 2023, 1:03pm UTC](https://forum.knime.com/t/change-2-date-format-in-a-column/67475/8 "2023-06-02T13:03:05Z")

</div>

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