The "general" documentation says:
getDay() – Returns the day of the week of the date object according to local time.
getDay() returns a value between 0 and 6.
Return Values:
0 = Sunday
1 = Monday
2 = Tuesday
3 = Wednesday
4 = Thursday
5 = Friday
6= Saturday
var today = new Date();
var days = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
var dayOfWeek = today.getDay();
var sDay = "Today is: " + days[dayOfWeek];
I seem to experience 2 kinds of problems.
1. Sometimes the result of "dow" is the day of month (1 thru 31)
2. Sometimes the result is the same integer for all bars (the integer appears to be the day of the week, ex: 2 for tuesday)
3. Sometimes, not sure what it's showing.
HELP
How can I get the day of week properly?
Thank you in advance.
Code:
function preMain() {
setPriceStudy(true);
setStudyTitle("test");
}
function main() {
var indcurr = getCurrentBarIndex();
var today = new Date();
var dayOfWeek = today.getDay();
debugPrintln("indcurr="+indcurr+" dow="+dayOfWeek);
}
getDay() – Returns the day of the week of the date object according to local time.
getDay() returns a value between 0 and 6.
Return Values:
0 = Sunday
1 = Monday
2 = Tuesday
3 = Wednesday
4 = Thursday
5 = Friday
6= Saturday
var today = new Date();
var days = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
var dayOfWeek = today.getDay();
var sDay = "Today is: " + days[dayOfWeek];
I seem to experience 2 kinds of problems.
1. Sometimes the result of "dow" is the day of month (1 thru 31)
2. Sometimes the result is the same integer for all bars (the integer appears to be the day of the week, ex: 2 for tuesday)
3. Sometimes, not sure what it's showing.
HELP
How can I get the day of week properly?
Thank you in advance.
Code:
function preMain() {
setPriceStudy(true);
setStudyTitle("test");
}
function main() {
var indcurr = getCurrentBarIndex();
var today = new Date();
var dayOfWeek = today.getDay();
debugPrintln("indcurr="+indcurr+" dow="+dayOfWeek);
}
Comment