Java Action Get integer from Datetime

0
Hello, I am using the java action “Get integer from Datetime” to extract the month from a date that is input earlier in the app. When I use the same setup but use [CurrentDateTime] instead everything works the way I want it to. When I put in my own attribute it doesn’t work. Hello, I am using the java action “Get integer from Datetime” to extract the month from a date that is input earlier in the app. When I use the same setup but use [CurrentDateTime] instead everything works the way I want it to. When I put in my own attribute it doesn’t work.
asked
3 answers
4

Hi Ashley,

Use Create Variable and pass below function you will get output in integer for month.

 

ParseInteger(formatDateTime($object/Date1,'MM'))
answered
1

I’d suggest checking the DateTime attribute is not empty before calling the Java Action.
 

If you are just after the month as an Integer, you can do this without using a Java Action. You can use the built in formatDateTime function to extract the month as a String, then use parseInteger to convert that String into an Integer. Something like this should work…

 

parseInteger(formatDateTime($object/Date1,'MM'))


Hope this helps.
 

answered
0

Hi Ashley,

 

Just check whether your input attribute date time is properly giving date just like CurrentDateTime.

answered