How can I get the month and year in question by using a date type variable ?

I have a date type input, and I want to get the month from that dt value to put in a int variable and the same thing with year, how can I do that ?

Hi,

I don't know if I understood what you want, but if I understand, please you can try this:

SyntaxEditor Code Snippet

TextToInteger(DateTimeToText(dt))

Cheers

Miguel Verdasca wrote:

Hi,

I don't know if I understood what you want, but if I understand, please you can try this:

SyntaxEditor Code Snippet

TextToInteger(DateTimeToText(dt))

Cheers


Hey thanks for you´r help,what I want is to, per example, I choose the date 01-06-2020, I want to put that "06" in to one int variable alone

Hi,

There are two in-built functions are there as Month() and Year() . when u try to assign the month or year to another variable just pass the dt value through those functions.

Ex : Month (dt)

So, you can do it:

SyntaxEditor Code Snippet

Year(dt)
Month(dt)
Day(dt)


Please see the below screenshot and assign the value to your variable.

Suprio Roy wrote:


Please see the below screenshot and assign the value to your variable.


Hey, so I have to create a get in where I put my dt and then do that code is that it ?

Solution

Your dt is an input variable from what I understand, you only have to use the input widget or the variable you want to assign the variable with those actions that we show you:


Variable_or_widget.input = Day (inputVar_dt)

Solution

Miguel Verdasca wrote:

Your dt is an input variable from what I understand, you only have to use the input widget or the variable you want to assign the variable with those actions that we show you:


Variable_or_widget.input = Day (inputVar_dt)

Hey, was it like this that you guys told me to do right?

Yes, exactly this Neyrivan. =)

Yes correct

Hi Neyrivan silva,

See the sample App

please find the attached .oml solution file

Hope this helps you!


Regards,

Benjith Sam

Thank you to every one that has helped me! Good coding to ya´ll