I have to get Browser Local date and time with Javascript and compare it in PHP IF statement with value from database on page load to determine if product expired or not. How do I solve the issue without using cookies and or sessions?
Javascript
<script>
var currentDate = new Date(),
day = ('0' + (currentDate.getDate()+1)).slice(-2),
month = ('0' + (currentDate.getMonth()+1)).slice(-2),
year = currentDate.getFullYear();
var currentTime = new Date(),
hours = currentTime.getHours(),
minutes = currentTime.getMinutes();
if (minutes < 10) {
minutes = '0' + minutes;
}
document.write(day + '/' + month + '/' + year + ' ' + hours + ':' + minutes)
</script>
PHP
if(strtotime( date and time from SCRIPT ) < strtotime($events date and time exiptation as $events_total_SKU[$e]['sales_end']))
{
print(" OK ");
.... and shopping cart code
}
else{
print(" Expired ");
}