hawks76
Enthusiast
Enthusiast

java.util.date and Date objects

Jump to solution

I'm working on a workflow getting the lease end date of deployments.  That returns a java.util.date object.  Is there a way to convert this to a Date object?  I'm trying to get the days between the current date and the lease end date.  I can get that, but it returns a number like this:  81.54834221064814

What i would like to do is convert the java.util.date to Date so i can pull the year, month and date out and create a new date with a certain time on it.

Or alternatively, how can i take 81.54834221064814 and trim it to only be 81.

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee

Hi,

To get the largest integer number which is less than or equal to a given number, you can use Math.floor() function.

// Should print 81

System.log( Math.floor(81.54834221064814) );

java.util.Date object has a method getTime() which returns the number of milliseconds since January 1st, 1970, and the Javascript's Date object has a method setTime(number) which you can use to set the timestamp of the Date object to a particular point of time taken from the java.util.Date object.

View solution in original post

0 Kudos
2 Replies
iiliev
VMware Employee
VMware Employee

Hi,

To get the largest integer number which is less than or equal to a given number, you can use Math.floor() function.

// Should print 81

System.log( Math.floor(81.54834221064814) );

java.util.Date object has a method getTime() which returns the number of milliseconds since January 1st, 1970, and the Javascript's Date object has a method setTime(number) which you can use to set the timestamp of the Date object to a particular point of time taken from the java.util.Date object.

View solution in original post

0 Kudos
eservent
Enthusiast
Enthusiast

Hi Hawks76,

I worked a lot on Lease and Archive deployment date. Maybe I kwnow a solution to your problem.

But I'm not sure to understand where you get the property of java.util.date.

Could you tell me which action/function you call to retrieve your deployment object ?

Emmanuel.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Emmanuel.
0 Kudos