Count down to XMAS

1

Stats

1,681 visits, 2,175 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 7 Dec, 2015. Last updated 19 Feb, 2019

Hi all,

Merry Christmas & Happy New Year to you!

This tutorial will explain how you can count down to a day or an event of your choice.

Step 1: Download Date plugin

rex_rainbow date plugin (http://c2rexplugins.weebly.com/)

Logic : the rex_rainbow date plugin will provide you the Unix style time in millisecond that can be exploited to to make a countdown time for a particular day or event as explained below.

    @Convert number of seconds into hours, minutes and seconds and return an array       containing those values to create count down timer.
    // variables
    timeStamp  = Number of seconds to parse  // this is fteched from dae plugin
    secondsInAMinute = 60
    secondsInAnHour  = 60 * secondsInAMinute
    secondsInADay    = 24 * secondsInAnHour
    // extract days
    days = floor(inputSeconds / secondsInADay)
    // extract hours
    hourSeconds = inputSeconds % secondsInADay
    hours = floor(hourSeconds / secondsInAnHour)
    // extract minutes
    minuteSeconds = hourSeconds % secondsInAnHour
    minutes = floor(minuteSeconds / secondsInAMinute)
    // extract the remaining seconds
    remainingSeconds = minuteSeconds % secondsInAMinute
    seconds = ceil(remainingSeconds)

Step 2: declare following variables for conversion.

Step 3: write a function to convert the fetched seconds into days, hours, minutes and seconds.

Step 4: call this function every second for real time update.

That it, hope might be useful in some way.

Demo and CAPX here.

Download

  • 0 Comments

Want to leave a comment? Login or Register an account!