# Date format statements in Spark SQL Query nodes

**URL:** <https://forum.knime.com/t/date-format-statements-in-spark-sql-query-nodes/87480>\
**Category:** KNIME Analytics Platform\
**Tags:** big-data\
**Created:** [April 4, 2025, 5:34am UTC](https://forum.knime.com/t/date-format-statements-in-spark-sql-query-nodes/87480 "2025-04-04T05:34:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JaeHwanChoi](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/j/3ab097/32.png) [@JaeHwanChoi](https://forum.knime.com/u/JaeHwanChoi)\
**Post date:** [April 4, 2025, 5:34am UTC](https://forum.knime.com/t/date-format-statements-in-spark-sql-query-nodes/87480/1 "2025-04-04T05:34:08Z")

</div>

Hi, I have a question for the Nim Support team.

I am currently trying to create a date column via Spark SQL Query.

When I run the query below, the date data is generated in a different format and not represented in the actual table like yyyy-MM-dd(2024-04-02) which is what I want. How can I resolve these issues?

* * *

SELECT year,month,day,  
TO\_DATE(CONCAT\_WS(“-”,`year`,LPAD(`month`,2,‘0’),LPAD(`day`,2,‘0’)),‘yyyy-MM-dd’) AS DATE  
FROM #table#

* * *

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/4/2/4254efd245730d1a2072afb44275530fd34d2623.png)

---

<div class="post-metadata">

**Author:** ![thor\_landstrom](https://forum-cdn.knime.com/user_avatar/forum.knime.com/thor_landstrom/32/65984_2.png) [@thor\_landstrom](https://forum.knime.com/u/thor_landstrom)\
**Post date:** [April 15, 2025, 5:30pm UTC](https://forum.knime.com/t/date-format-statements-in-spark-sql-query-nodes/87480/2 "2025-04-15T17:30:16Z")

</div>

Hey @JaeHwanChoi,

Since you already pull your year, month, and day:

You can bypass the complex query you are doing by using the column combiner and the string to date time nodes.

Here is the result based off that image you sent:

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

where I just combined year, month, and day with ‘-’ delimiter.

For the string to date, I had the following config:

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

TL

---

<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:** [July 14, 2025, 5:31pm UTC](https://forum.knime.com/t/date-format-statements-in-spark-sql-query-nodes/87480/3 "2025-07-14T17:31:12Z")

</div>

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