Announcement

Collapse
No announcement yet.

May I have some help please?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • May I have some help please?

    I am trying to write some code that refers to the day of the week and when this happens, it does something.

    var today = new Date();
    var wday = today.getDay();

    debugPrintln("getDay=",+ getDay());
    debugPrintln("getHour=",+ getHour());
    debugPrintln("close=",+ close());
    debugPrintln("wday=",+ wday);

    Am I referencing this right? The only weekday(wday) I get is 6(saturday). That is today's date.The other numbers come out ok.

    There isn't very much written about this.

  • #2
    the problem is...

    You are continually getting todays day #.

    The "var today = new Date();" creates a new date value with todays (current) date/time. Thus, when you run the getDay() function on this variable - you get today's #.

    You need to use...

    var today = new Date();
    today = getValue("Time", 0);

    var wday = today.getDay();

    debugPrintln("getDay=",+ getDay());
    debugPrintln("getHour=",+ getHour());
    debugPrintln("close=",+ close());
    debugPrintln("wday=",+ wday);
    vTime = getValue("Time", 0);
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Thank You

      Wow! Thanks, that really works.

      Comment


      • #4
        Brad,

        Yes, this is good info, I assumed the day of the week was unavailable for historical data.

        I attached an efs that demonstrates different methods for grabbing time and date info that I use. I went ahead and added your code snippets to check it out. Then ran it in real time and tick playback, works great, thanks!
        Attached Files
        Last edited by Guest; 08-22-2004, 04:38 PM.

        Comment


        • #5
          you're very welcome

          More FREE little tid-bits of EFS code in my head.. Somethings I'm good at, other times I have to ask for help too.

          B
          Brad Matheny
          eSignal Solution Provider since 2000

          Comment

          Working...
          X