Change date from yyyyMM to dd MMMM yyyy

I have come across this issue recently with the manipulation…

If the number entered is 202201 then it needs to be 01 August 2021 and so on.
If the number is 202206 then the date should be 01 January 2022. I have years in 2020 to 2025 and I do not know how to fix this I have attached date list if anyone can help me with this issue. Thanks in advance.
KNIMEHelp.xlsx (10.2 KB)

Hello @psycho ,

sorry but I did not get your logic. 202201 is converted to 01 August 2021. Why August? Why 2021?
Also 202206 is converted to 01 January 2022. Why January? Or if it is January why 01 and not 06?

Or this is your task? Assuming that 202201 is equivalent with 01 August 2021, and 202206 is equivalent with 01 January 2022 than your data in your excel are equivalent with what?

Moreover please tell us what have you already done to achieve your goal? Which nodes did you use, with which settings, where did you stuck etc. In this way you make easier to the other Forum user to help you in the right direction moreover it creates an atmosphere we are working together.

Regards

1 Like

Or this is your task? Assuming that 202201 is equivalent with 01 August 2021, and 202206 is equivalent with 01 January 2022 than your data in your excel are equivalent with what?
This is right this is what i have to do convert based on that rule.

Hi @psycho ,

We still don’t know what that rule is…

As @dora_gcs has pointed out, there’s not enough details to determine what the rule is, and with just 2 sample records, it’s not enough to see a pattern for certain in order to determine the logic.

The only logic that I see in there is that:
If 202201 can be assumed to be January 2022; and
202206 can be assumed to be June 2022

Then the pattern seem to be that the result is 5 months before that date:
202201 - 5 months = August 2021
202206 - 5 months = January 2022

You can use the Date/Time Shift for this

  1. Use string manipulation to convert 202201 to 2022-01-01 and so on.
  2. Convert the result to Date using String to Date node
  3. Use Date/Time Shift to remove 5 months

EDIT: I put something together for you. Something like this will do:

Input (Same as in your Excel sheet):

Results:

Here’s the workflow:

1 Like

Hi @psycho,

Supplementing the others, please confirm if you made a typo and the months should be equivelant or that a shift needs to apply. Below a way to accomplish the former in case this is your use case:

Since you always want to reflect the starting date of the month as 01, I opt to add this to string input to supplement the date with a Column Expression or String Manipulation.

What follows is a String to Date and Date to String conversion. First, mask it as yyyyMMdd in the first node.

Then mask it as dd MMMM yyyy in the to String conversion.

WF:
change date from yyyyMM to dd MMMM yyyy.knwf (24.3 KB)

@bruno29a has a good solution for the shift.

1 Like

This is worked Thank you Arjen

This is also worked , Thank you Bruno. I have posted one more query related to one of my previous could you take a look at that please Bruno?

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