Web Analytics Made Easy -
StatCounter day from given date - CodingForum

Announcement

Collapse
No announcement yet.

day from given date

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

  • day from given date

    I have a date in the form yyyy-mm-dd but need somehow, to return the day of the week from it. Is there any predefined syntax for this? if not, what is the best way to go about it.
    Cheers.

  • #2
    You can use JavaScripts Date Function to figure it out

    var theDate = newDate(date_variable);

    theDay = d.getDay();

    now the format of the date_variable is m/d/y

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

    Comment


    • #3
      thats handy, cheers... I have tried it and it just doesnt get the date right though!!

      I have

      var y=2004
      var m=3
      var d=31

      then

      var c = new Date(m,d,y)

      and no matter what combination i use e.g. y,m,d or m,d,y or m/d/y etc etc i just get completely random dates.

      Any idea how I can fix this?
      Thanks.

      Comment


      • #4
        its ok, it works now - sorry! I didnt know that months were zero based!

        Comment

        Working...
        X