Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #10152 > unrolled thread
| Started by | Svenfischer2@email.com (Sven Fischer) |
|---|---|
| First post | 2011-11-21 16:58 +0000 |
| Last post | 2011-11-21 10:25 -0800 |
| Articles | 7 — 6 participants |
Back to article view | Back to comp.lang.java.programmer
Easiest/shortest way to get day of week (e.g. MON) from "dd.mm.yyyy" string? Svenfischer2@email.com (Sven Fischer) - 2011-11-21 16:58 +0000
Re: Easiest/shortest way to get day of week (e.g. MON) from "dd.mm.yyyy" string? jlp <jlp@jlp.com> - 2011-11-21 18:40 +0100
Re: Easiest/shortest way to get day of week (e.g. MON) from "dd.mm.yyyy" string? jlp <jlp@jlp.com> - 2011-11-21 18:45 +0100
Re: Easiest/shortest way to get day of week (e.g. MON) from "dd.mm.yyyy" string? Lew <lewbloch@gmail.com> - 2011-11-21 14:12 -0800
Re: Easiest/shortest way to get day of week (e.g. MON) from "dd.mm.yyyy" string? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-11-21 17:41 +0000
Re: Easiest/shortest way to get day of week (e.g. MON) from "dd.mm.yyyy" string? Mayeul <mayeul.marguet@free.fr> - 2011-11-21 19:17 +0100
Re: Easiest/shortest way to get day of week (e.g. MON) from "dd.mm.yyyy" string? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-21 10:25 -0800
| From | Svenfischer2@email.com (Sven Fischer) |
|---|---|
| Date | 2011-11-21 16:58 +0000 |
| Subject | Easiest/shortest way to get day of week (e.g. MON) from "dd.mm.yyyy" string? |
| Message-ID | <4eca833c$0$6571$9b4e6d93@newsspool3.arcor-online.net> |
Assume I have a date as a string with the pattern "dd.mm.yyyy". What is the easiest/shortest way to get the day of week (e.g. "MON" for Monday) from this date? Sven
[toc] | [next] | [standalone]
| From | jlp <jlp@jlp.com> |
|---|---|
| Date | 2011-11-21 18:40 +0100 |
| Message-ID | <4eca8d1a$0$2507$ba4acef3@reader.news.orange.fr> |
| In reply to | #10152 |
Le 21/11/2011 17:58, Sven Fischer a écrit : > Assume I have a date as a string with the pattern "dd.mm.yyyy". > > What is the easiest/shortest way to get the day of week (e.g. "MON" for Monday) > from this date? > > Sven > create a Calendar object with the date and Calendar.get( DAY_OF_WEEK) return 0 for SUNDAY, 1 for MONDAY ... -- Cordialement Jean-Louis Pasturel
[toc] | [prev] | [next] | [standalone]
| From | jlp <jlp@jlp.com> |
|---|---|
| Date | 2011-11-21 18:45 +0100 |
| Message-ID | <4eca8e1c$0$2507$ba4acef3@reader.news.orange.fr> |
| In reply to | #10153 |
Le 21/11/2011 18:40, jlp a écrit : > Le 21/11/2011 17:58, Sven Fischer a écrit : >> Assume I have a date as a string with the pattern "dd.mm.yyyy". >> >> What is the easiest/shortest way to get the day of week (e.g. "MON" >> for Monday) >> from this date? >> >> Sven >> > create a Calendar object with the date and Calendar.get( DAY_OF_WEEK) > return 0 for SUNDAY, 1 for MONDAY ... > Sorry SUNDAY is 1, MONDAY 2 .... -- Cordialement Jean-Louis Pasturel
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2011-11-21 14:12 -0800 |
| Message-ID | <31270747.678.1321913566925.JavaMail.geo-discussion-forums@prnv30> |
| In reply to | #10155 |
jlp wrote: > jlp a écrit : >> Sven Fischer a écrit : >>> Assume I have a date as a string with the pattern "dd.mm.yyyy". >>> >>> What is the easiest/shortest way to get the day of week (e.g. "MON" >>> for Monday) >>> from this date? >>> >> create a Calendar object with the date and Calendar.get( DAY_OF_WEEK) >> return 0 for SUNDAY, 1 for MONDAY ... >> > Sorry SUNDAY is 1, MONDAY 2 .... The numeric value is immaterial. -- Lew
[toc] | [prev] | [next] | [standalone]
| From | Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> |
|---|---|
| Date | 2011-11-21 17:41 +0000 |
| Message-ID | <slrnjcl3a0.fvg.avl@gamma.logic.tuwien.ac.at> |
| In reply to | #10152 |
Sven Fischer <Svenfischer2@email.com> wrote: > Assume I have a date as a string with the pattern "dd.mm.yyyy". > What is the easiest/shortest way to get the day of week (e.g. "MON" for Monday) > from this date? Look at java.text.SimpleDateFormat (for parsing the string) and at java.util.Calendar (for extracting the day of week)
[toc] | [prev] | [next] | [standalone]
| From | Mayeul <mayeul.marguet@free.fr> |
|---|---|
| Date | 2011-11-21 19:17 +0100 |
| Message-ID | <4eca94aa$0$18836$426a74cc@news.free.fr> |
| In reply to | #10152 |
On 21/11/2011 17:58, Sven Fischer wrote: > Assume I have a date as a string with the pattern "dd.mm.yyyy". > > What is the easiest/shortest way to get the day of week (e.g. "MON" for Monday) > from this date? > > Sven > If you ask me the /simplest/ way to do that is with two SimpleDateFormats: - one to parse the pattern to a Date, - the other just to format the Date to corresponding day of the week. Then some toUpperCase(Locale.US) to obtain MON instead of Mon. Forcing the second SimpleDateFormat to Locale.US might be preferable. Sounds lazy, probably quite inefficient, and is not flexible at all. But it is a three-liners, with very short lines. -- Mayeul
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2011-11-21 10:25 -0800 |
| Message-ID | <er5lc7po6smlsspm2mbr9tjqo2td261a4f@4ax.com> |
| In reply to | #10152 |
On 21 Nov 2011 16:58:36 GMT, Svenfischer2@email.com (Sven Fischer) wrote, quoted or indirectly quoted someone who said : >Assume I have a date as a string with the pattern "dd.mm.yyyy". > >What is the easiest/shortest way to get the day of week (e.g. "MON" for Monday) >from this date? see http://mindprod.com/jgloss/calendar.html for the usual methods. See http://mindprod.com/products1.html#BIGDATE for the easy way. -- Roedy Green Canadian Mind Products http://mindprod.com I can't come to bed just yet. Somebody is wrong on the Internet.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web