# Date type Workflow Variable

**URL:** <https://forum.knime.com/t/date-type-workflow-variable/23119>\
**Category:** KNIME Analytics Platform\
**Created:** [April 28, 2020, 7:37pm UTC](https://forum.knime.com/t/date-type-workflow-variable/23119 "2020-04-28T19:37:06Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![francisco\_munoz\_m](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/f/45deac/32.png) [@francisco\_munoz\_m](https://forum.knime.com/u/francisco_munoz_m)\
**Post date:** [April 29, 2020, 9:08pm UTC](https://forum.knime.com/t/date-type-workflow-variable/23119/11 "2020-04-29T21:08:30Z")

</div>

Problem solved.

I just created a String workflow variable with the format “yyyy-mm-dd”. Since I only require it while using a Java Snippet node, I just use a method to turn it into a Date variable (which serves only the node’s code) each time.

For example:

> workflow\_var = “2020-12-15”

Then, inside the node’s code:

> LocalDate code\_var = LocalDate.parse(workflow\_var)

or (in case you haven’t explicitly imported the java.time.LocalDate library)

> java.time.LocalDate code\_var = LocalDate.parse(workflow\_var)

In case I need the time, I just take it as 12 PM and replace LocalDate with LocalDateTime:

> LocalDateTime code\_var = LocalDateTime.parse(workflow\_var + “T12:00”)

> java.time.LocalDateTime code\_var = java.time.LocalDateTime.parse(workflow\_var + “T12:00”)

Cheers

---

_[View the full topic](https://forum.knime.com/t/date-type-workflow-variable/23119)._
