Thread: Name of the day

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

    Join Date
    Feb 2002
    Location
    Amersfoort, The Netherlands
    Posts
    10
    Rep Power
    0

    Question Name of the day


    I need a function that returns the name of the day when I give it a date.
    I believe I need a function in the calender class, but can't find it at SUN... maybe this is faster..
    example: give_day_name("2002-09-11") returns "wednesday".

    Suggestions please!

    Erwin
  2. #2
  3. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    Calendar.get(Calendar.DAY_OF_WEEK) will return 1 for sunday, 2 for monday, etc. They're actually constants, Calendar.SUNDAY, Calendar.MONDAY, etc.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    Amersfoort, The Netherlands
    Posts
    10
    Rep Power
    0
    Thanks Bricker42, that's just what I needed!

    Erwin
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    Amersfoort, The Netherlands
    Posts
    10
    Rep Power
    0
    More help please, I can;y get this to work :-(

    Erwin
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    Amersfoort, The Netherlands
    Posts
    10
    Rep Power
    0
    Please Help! :-(

    This is the error:

    org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.


    An error occurred at line: 326 in the jsp file: /Rubriek_adv.jsp

    Generated servlet error:
    /opt/jakarta-tomcat-4.0.3/work/localhost/test/Rubriek_0005fadv$jsp.java:317: Invalid type expression.
    Calendar.get(Calendar.DAY_OF_WEEK)


    Suggestions Please!

    Erwin
  10. #6
  11. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    I'm not sure why it's doing that. Can you tell me what you're trying to do? Maybe there's another way to get the info you want.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    Amersfoort, The Netherlands
    Posts
    10
    Rep Power
    0
    I have a listbox in a page, containing dates. The user chooses a date to place an advertisement. To help him, I would like to show the name of the day next to the datre: example rows of the listbox:

    17-09-2002 Tuesday
    18-09-2002 Wednesday
    .
    .
    22-09-2002 Sunday
  14. #8
  15. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    Just change the code I gave you here [Day name] to have a different format (all the E's). Something like "MM-dd-yyyy EEEEEEEEEE", maybe.
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    Amersfoort, The Netherlands
    Posts
    10
    Rep Power
    0
    You';re my man! ;-)

    Erwin

IMN logo majestic logo threadwatch logo seochat tools logo