Working with Countdown

4 replies · opened Jan 10, 2018

HHRJan 10, 2018

Dear Canvas,

I'm trying to make a 2 days countdown from current date using php. I manage to use php strtotime() function to add 2 days from current date. The problem arise is when injecting php variable to the jQuery script which we already knows as below:

The thing is that Javascript formats the Month as following:

0 as January
1 as February
2 as March
3 as April
4 as May
5 as June
6 as July
7 as August
8 as September
9 as October
10 as November
11 as December

How can I accomplish this since php date() function can never come up with value '0' that will represent January? Any workaround solution for this issue?

I attached the screenshot for my works and code snippet.

Thanks

HHRJan 12, 2018

Hello again Canvas

Did you guys understand my problem? I’m stuck here.

Regards

HHRJan 18, 2018

Any answer would be much appreciated. I can't afford to wasting any of my time again.

SSemicolon WebSTAFFJan 22, 2018

Hello,

Thanks for your Patience!

Unfortunately, this is a default Javascript functionality that cannot be changed. You can consider using the following PHP Code:

This will definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

HHRFeb 13, 2018

How to add two (2) days from this?

<?php echo date('Y-') . (date('n')-1) . date('-j'); ?>

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard
Working with Countdown · Canvas Template Support