Check dates stored in a string

Hi,
I'm using a free input text plugin which can store a string in a variable.
I have some problems working on dates: let's suppose player have stored in var(x). I.e. = "01\01\2001" or "01/01/2001"
I want to store in another variable the day value ("01" in this case), and in another the month value (still "01" in this case).
I can't figure out how to do this.
I tried to check if ("1|01") < ("\1\|\01\|\2\|\02\.......") but it doesn't work...
I suppose there is some problem with "\", "/" symbols cuz even
Code:
$gameVariables.value(x).toLowerCase().includes("01\")
always turns false to me. Is it possible?
tried to check if ("1|01") < ("\1\|\01\|\2\|\02\.......") but it doesn't work...

That's not how the or || operator is written or used. The operator won't check anything inside your string (the stuff between " quotes ") It works on the condition, not the string:

Also, do you want your digits to be numbers or strings? Right now they're being treated as strings.

If (x == '1' || x == '01') { doThis };
\ is an escape character, meaning it would be considering that part as \" (an escaped double quote, which would match a literal double quote instead of ending a string)

What you want is ("01\\"). Escaping the backslash turns it into an actual backslash in the string.

Also this would be much easier if you parse your input as a Date before manipulating it:

1594997235317.png
\ is an escape character, meaning it would be considering that part as \" (an escaped double quote, which would match a literal double quote instead of ending a string)

What you want is ("01\\"). Escaping the backslash turns it into an actual backslash in the string.

Also this would be much easier if you parse your input as a Date before manipulating it:

View attachment 151672

Your example works, but how can I get also the day value?
Following what you wrote I can only get the second value (month) of a date (01/05/1995 --> it stores only the "5" value).
getDate() gets the day, getMonth() gets the month (it starts at 0 so you'll have to add 1 to the value to get an actual month number) and getYear() gets the year.
getDate() gets the day, getMonth() gets the month (it starts at 0 so you'll have to add 1 to the value to get an actual month number) and getYear() gets the year.
Great, thank you again^^
Solved

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/check-dates-stored-in-a-string.124165/