Laurens
New Member
I'm totally struggling with a problem with javascript.
What I am aiming to do is to get today's date in Unix time like this:
Then I want to take that date and run it through a function with 'if, else if' statements. Essentially my aim is to take 'date' and see where in falls in terms of a schedule in which closing times change depending on what week it is. For example:
(that isn't the whole thing btw)
I cannot for the life of me get this to work. I'm a complete n00b when it comes to javascript, so if you understand what I'm on about, and you can see what I'm doing wrong could you please help me??
My basic aim is to take the date, ask if it is between date x and date y, and if it doesn't to go on to the next line and ask the same (where x and y are different values). It's totally frying my little brain...
What I am aiming to do is to get today's date in Unix time like this:
Code:
<i>
</i>var today = new Date();
var date = today.getTime();
Then I want to take that date and run it through a function with 'if, else if' statements. Essentially my aim is to take 'date' and see where in falls in terms of a schedule in which closing times change depending on what week it is. For example:
Code:
if (date >1459728000 && date <1460332800){
return '17.00';
}
else if (date >1460332800 && date <1460937600){
return '17.15';
I cannot for the life of me get this to work. I'm a complete n00b when it comes to javascript, so if you understand what I'm on about, and you can see what I'm doing wrong could you please help me??
My basic aim is to take the date, ask if it is between date x and date y, and if it doesn't to go on to the next line and ask the same (where x and y are different values). It's totally frying my little brain...