Article View: borland.public.jbuilder.java.language
Article #15389Re: String To Date
From: arnold.chatelain
Date: Wed, 16 Jun 1999 00:00
Date: Wed, 16 Jun 1999 00:00
64 lines
2362 bytes
2362 bytes
This is a multi-part message in MIME format.
--------------176356BC6A3D1E8FA6AB377F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Geoff Marshall wrote:
> As a new comer to JB can anybody help me convert a string to a date?
>
> I have tried
>
> Date myDate = Date(<string>);
>
> ---> Error "Date(jaa.land.string) not found..."
> and also
>
> Date myDate = DateFormat.parse(string);
>
> ---> Error "Variable DateFormat not found ..."
>
> I have included the following:
> import java.io.*;
> import java.util.*;
> import java.lang.*;
>
> Also can anybody say what string formats are acceptable? I would like
> to use d/mm/yyyy but could re-arrange these.
>
> Thanks in advance for any assistance,
>
> Geoff Marshall
if you use JDK 1.2
Date(String) is deprecated, you can use
DateFormat.parse("07/10/96 4:5 PM, PDT") and you become a Date object
Don't forgotten to import java.text.DateFormat
Best regards
Arnold
--------------176356BC6A3D1E8FA6AB377F
Content-Type: text/x-vcard; charset=us-ascii;
name="arnold.chatelain.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for �����
Content-Disposition: attachment;
filename="arnold.chatelain.vcf"
begin:vcard
n:Ch�telain;Arnold
tel;work:42260
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:arnold.chatelain@mc.alcatel.de
fn:Arnold Chatelain
end:vcard
--------------176356BC6A3D1E8FA6AB377F--
Technical Details
Message-ID:
<3767B9EE.5A9A3094@mc.alcatel.de>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3762CD95.5B8F5AAC@fsbdial.co.uk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,3d8746921d3fd1df X-Google-Attributes: gidf74b3,public From: arnold.chatelain@mc.alcatel.de Subject: Re: String To Date Date: 1999/06/16 Message-ID: <3767B9EE.5A9A3094@mc.alcatel.de> X-Deja-AN: 490280000 Cache-Post-Path: sls7ag!sls6yc.stgl.sel.alcatel.de References: <3762CD95.5B8F5AAC@fsbdial.co.uk> To: aas20despam@dial.pipex.com X-Accept-Language: en Content-Type: multipart/mixed; boundary="------------176356BC6A3D1E8FA6AB377F" X-Complaints-To: news@ks.sel.alcatel.de X-Trace: sls7ag.stgl.sel.alcatel.de 929544662 2840 127.0.0.1 (16 Jun 1999 14:51:02 GMT) Organization: ALCATEL SEL X-Cache: nntpcache 2.3.3 (see http://www.nntpcache.org/) Mime-Version: 1.0 NNTP-Posting-Date: 16 Jun 1999 14:51:02 GMT Newsgroups: borland.public.jbuilder.java.language