Article View: borland.public.jbuilder.java.language
Article #7447Re: How to parse dates?
From: Mark Griffiths
Date: Tue, 19 Jun 2001 20:41
Date: Tue, 19 Jun 2001 20:41
24 lines
1615 bytes
1615 bytes
"Alex Colic" <alex.colic@pop-ware.com> wrote in message
news:3b2f6a3f$2_2@dnews...
>
> I have a function that returns a date in a month, day, year, time format.
> EG. 10/5/00 7:00:00 AM
>
> What I need to do is only display the date portion of the String only.
> Sometimes the String has a time element some times it does not.
>
How about just looking for the first space and then stripping everything
after that. e.g.
String date = someFunction();
if (date.indexOf(' ') != -1) {
date = date.substring(0, date.indexOf(' '));
}
Of course, it would be 'cleaner' if you could modify the behaviour of
someFunction() instead of resorting to the above hack, but I am assuming
that is not possible to modify someFunction()?
--
Mark
Technical Details
Message-ID:
<3b2fb8ed_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3b2f6a3f$2_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,990109a904f1314 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-06-19 13:44:39 PST From: "Mark Griffiths" <DONT.SPAM.mark@chive.com> Newsgroups: borland.public.jbuilder.java.language References: <3b2f6a3f$2_2@dnews> Subject: Re: How to parse dates? Date: Tue, 19 Jun 2001 21:41:23 +0100 Lines: 26 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 213.122.155.202 Message-ID: <3b2fb8ed_2@dnews> X-Trace: dnews 992983277 213.122.155.202 (19 Jun 2001 13:41:17 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews