cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
613
Views
0
Helpful
3
Replies

Using CRA java functions

Voland8315
Level 1
Level 1

Hello. I have CRA ver 3.1(2)

I want to get curent date information using java function getDate(). I can't figure out how it works. It returns integer value. When i saved this value in database i saw that it was zero.

Where can i get more information and examples of using java function like setSeconds and other?

3 Replies 3

sferland
Level 1
Level 1

First, you need a "Date" variable.

Then, with the help of a SET step, you call the date constructor.

Ex: SET my_date = new Date()

At this point, the variable "my_date" will contain the current date and time. It is now easy to extract the year, the month, the day, the hour, etc. using the methods associates with a "Date", like .getMonth().

Hope this help.

Please rate helpful post.

Steven

I can't do that in the SET step. The properies of this step are Variable and Assign.

I set variable = my_date( which is Date type)

and write - new Date() - in the property assign.

This call an error. I set step "Create java object", and run java methods getMonth and other . I figured out why this did not work. When i simply upload the new script in the place of old version it did not work correctly. When i fully deleted old version of the script and then uploaded the new - it fixed the problem.

Oups ! Sorry, I did not see that you was talking about version 3.1(2).

My post was referring to version 4.