I am using a Datepicker on my site and want the current day (selected on page load) to advance one day forward at 2pm.
$(function() {
var dd = 0
var dsc = new Date();
if (dsc.getHours() > 14) {
dd = dd + 1; // go one day in the future
}
Works perfectly but this uses the local time on the users machine.
So I tried this.
$(function() {
var dd = 0
var dsc = ('<%= currentHour %>');
if (dsc > 14) {
dd = dd + 1; // go one day in the future
}
The currentHour gets it’s value from
Dim currentHour
currentHour = Hour(Now)
But this won’t work. Can anyone help.
I am assuming you are declaring
currentHouron the server side and that it outputs correctly in the JavaScript fragment you posted.You don’t need to put the
currentHourin quotes and parentheses.You don’t need the
dscvariable either:Edit: (following the comments)
The <%= %> syntax is an asp feature that will only be processed when in an ASP page. If this is in a static JS file, it will remain as it is and not be processed.