Forum Discussion
TariqHussain
9 years agoBoss
cjdinger if you dont have issue using javascript there you can use this pure js script . this will work fine according to your requirement
<script> var d = new Date(); var curr_date = d.getDate(); var curr_month = d.getMonth();/* Returns the month (from 0-11) */ var curr_month_plus= curr_month+1; /* because if the month is 4 it will show output 3 so we have to add +1 with month*/ var curr_year = d.getFullYear(); function dstrToUTC(ds) { var dsarr = ds.split("/"); var mm = parseInt(dsarr[0],10); var dd = parseInt(dsarr[1],10); var yy = parseInt(dsarr[2],10); return Date.UTC(yy,mm-1,dd,0,0,0); } function daysTogo(ds2) { var now =curr_month_plus+ '/' + curr_date + '/' + curr_year; var d1 = dstrToUTC(now); var d2 = dstrToUTC(ds2); var oneday = 86400000; return (d2-d1) / oneday; } var b; eventDate = "4/18/2016"; alert(+daysTogo(eventDate)+" days to go!"); </script>
If my post is helpful and answers your question, please give "Kudos" and "Accept it as a Solution."
Related Content
- 4 years ago
- 13 years agoInactive User
- 5 years ago