R
R
Ruslan Dasaev2019-07-12 18:18:54
JavaScript
Ruslan Dasaev, 2019-07-12 18:18:54

How to update the contents of the date attribute?

Good day. Please tell me the mechanics of changing the content of the html attribute. I have a timer, I took the Timer from here. It is necessary that the timer is updated at 0 o'clock and at 12 o'clock in the afternoon, and for this you need to add 12 hours to the data-finish attribute. Explain in general terms, how this is done, I encounter a similar task for the first time. How to work with a date object?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
leni_m, 2019-07-12
@leni_m

if (time >= 0 && time <12) {
    dataFinish = now + n дней;
} else {    // time >= 12 && time <24
    dataFinish = now + n дней - 12 часов;
}

So?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question