#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2008
    Posts
    250
    Rep Power
    13

    Calculate Day (as in Monday or Tuesday etc) from Date


    Calculate Day (as in Monday or Tuesday etc) from Date

    I have a value in a textbox (date) ex: 04/22/2013 2:51:00 PM
    Can I calculate from this value the day of the week?
    Any examples?
    Thanks
  2. #2
  3. Subconscious Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    15,461
    Rep Power
    9565
    Date

    In lieu of a cross-compatible way of getting a formatted date,
    Code:
    var date = new Date("04/22/2013 2:51:00 PM");
    var days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
    alert(days[date.getDay()]);

IMN logo majestic logo threadwatch logo seochat tools logo