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

    Join Date
    Oct 2008
    Posts
    241
    Rep Power
    11

    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. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,992
    Rep Power
    9397
    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