I
I
Ilyaploskov2019-03-12 15:29:40
JavaScript
Ilyaploskov, 2019-03-12 15:29:40

How to substitute date in ISO 8601 format 2017-12-04T22:00:00+00:00 (UTC time) + 2 hours?

Hello.
In UIKIT I want to make a countdown timer.
By default, the reverse report is displayed like this:

<div class="uk-grid-small uk-child-width-auto uk-margin" uk-grid uk-countdown="date: 2019-03-19T12:03:27+00:00">
    <div>
        <div class="uk-countdown-number uk-countdown-days"></div>
    </div>
    <div>
        <div class="uk-countdown-number uk-countdown-hours"></div>
    </div>
    <div>
        <div class="uk-countdown-number uk-countdown-minutes"></div>
    </div>
    <div>
        <div class="uk-countdown-number uk-countdown-seconds"></div>
    </div>
</div>

I need to use js in the uk-countdown ="date: 2019-03-19T12:03:27+00:00" attribute to substitute the current date +2 hours for a reverse report.
Help write a script. Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alex, 2019-03-12
@Ilyaploskov

A
Alex, 2019-03-12
@Kozack

const time = new Date((new Date).getTime() + (2 * 60 * 60 * 1000)).toISOString()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question