|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Day name
I need the correct syntax of a java function that returns the name of the day of the given date.
Can anybody help me? Erwin |
|
#2
|
||||
|
||||
|
|
|
#3
|
|||
|
|||
|
Google is my friend too... Still, I need a working example; I'm fed up with the trial & error method. I don't have enough time for that.
I need something like this: Calendar.get(Calendar.DAY_OF_WEEK) What the .. is the correct syntax? Thanks in advance, Erwin |
|
#4
|
|||
|
|||
|
String tuesday = new java.text.SimpleDateFormat( "E").format( new java.util.Date().parse( "9-17-2002" ) );
|
|
#5
|
|||
|
|||
|
Bloody hell this thing was annoying. Here ya go.
Code:
Date day = ((DateFormat)new java.text.SimpleDateFormat( "MM-dd-yyyy" )).parse( "09-19-2002" ); String day_name = new java.text.SimpleDateFormat( "EEEEEEEEE" ).format( day ); |
|
#6
|
|||
|
|||
|
I'll check out the code right away!
Erwin By the way, what did you mean with "Bloody hell this thing was annoying"; the time it took to find the code? |
|
#7
|
|||
|
|||
|
Ya. SimpleDateFormat extends a class with a parse method that takes a long as a parameter instead of a Date. It took me awhile to track down why I was getting "java.text.SimpleDateFormat.parse( java.util.Date ) not found. long expected" or whatever the error was
![]() It looked like such a simple thing at first... |
|
#8
|
|||
|
|||
|
I understand what you mean; these are the minor irritations during software development. Happily, there are even more goodies to compensate this feeling.. ;-)
Erwin |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > Day name |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|