How to add an hour (or more) to timepicker value?

Hi everyone, is there a way to change the value of a timepicker to any number of hours, minutes and
Seconds to add?

Here’s an example:

Someone decides to attend an event. The event starts at 8 am and lasts approximately 1.5 hours. I would now like to display the time by which you are finished. Does anyone have any ideas about this?

I tried to add an addhour element to the timepicker, but it didn’t work.

I had imagined the following:

Date newDate = DateUtils.addHours(oldDate, 3);

How to solve your PROBLEM ?

  1. a DATE consists of MILLISECONDS started in:
    YEAR ------> 1970
    DATE -------> 01.JANUARY
    TIME: -------> 00:00:00

How much milliseconds we would get TODAY? (remember the timer was started 1970).

So let’s find it out!
1000millis x 60secs x 60mins x 24h x 365days x 51years

RESULT =???

let myCalculatedTimestamp = 1000*60*60*24*365*51; console.log(myCalculatedTimestamp);

We get this one…

//RESULT = 1608336000000

Of course this is still not correct, because we already have 11.11.2021
That means →
+11-Month
+11-Days
+7-hours (of my located-time) your time will differ from my time

Calculating an exact current time-stamp you can do here…

You event don’t have to do it, because you have an LIVE-RUNNING-TIMER, which shows you every second the current timestamp of today.

But how to get the current timeStamp by CODE ?

let currentDate = new Date(); 
console.log("Current-Date: ", currentDate);

let currentTimeStamp = new Date(currentDate).getTime(); 
console.log("Current-Time-Stamp: ", currentTimeStamp);

…or more simple…

let currentTimeStamp = new Date().getTime();

You can get a Time-Stamp of every date you want like…

let currentTimeStamp = new Date("11.11.1970").getTime();

I think the rest is clear and understandable, you surely will be able to continue without further help, right now.

Good luck!

Ah, that makes sense. Thank you very much!

No problem!