Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Convert Date to String
How do we convert convert the String to a date using the DateFormat Class

for e.g
Converting the String dateofbirth to a date




Report this thread to moderator Post Follow-up to this message
Old Post
Java
07-08-04 02:06 PM


Re: Convert Date to String
Stefan Waldmann wrote:

> ( @Rodey Green: SCNR ;-)

Oops, misspelt your name, sorry Roedy :-(
(Not a native speaker...)

Report this thread to moderator Post Follow-up to this message
Old Post
Stefan Waldmann
07-08-04 02:06 PM


Re: Convert Date to String
Stefan Waldmann wrote:

> ( @Rodey Green: SCNR ;-)

Oops, misspelt your name, sorry Roedy :-(
(Not a native speaker...)

Report this thread to moderator Post Follow-up to this message
Old Post
Stefan Waldmann
07-08-04 02:06 PM


Re: Convert Date to String
I still can't figure it out, Can u give the link to the code direclty or
type it here plz,
"Stefan Waldmann" <stefan.k.waldmann@vr-web.de> wrote in message
news:2l4qm5F8m36oU1@uni-berlin.de...
> Java wrote: 
Class 
>
> Using DateFormat#parse(String dateofbirth)
>
>
<http://java.sun.com/j2se/1.4.2/docs...rmat.html#parse(jav
a.lang.String)>
>
> First create a DateFormat object with the pattern that tells in what
> format your date is contained in the string



Report this thread to moderator Post Follow-up to this message
Old Post
Java
07-08-04 02:06 PM


Re: Convert Date to String
Java wrote:
> I still can't figure it out, Can u give the link to the code direclty or
> type it here plz,

You can find code samples at the URL I posted in my other reply:

http://mindprod.com/jgloss/calendar.html

Hope that helps.

Report this thread to moderator Post Follow-up to this message
Old Post
Stefan Waldmann
07-08-04 02:06 PM


Re: Convert Date to String
Java wrote:
> I still can't figure it out, Can u give the link to the code direclty or
> type it here plz,

import java.util.Date;
import java.text.SimpleDateFormat;
import java.text.ParseException;

public class DateTest
{
public static void main(String[] args)
{
String dateOfBirth = "1974-31-12";
SimpleDateFormat dFormat = new SimpleDateFormat("yyyy-mm-dd");

try {
Date birthday = dFormat.parse(dateOfBirth);
System.out.println(birthday);

System.out.println(dFormat.format(birthday));
}
catch(ParseException ex) {
ex.printStackTrace();
}

}
}

Report this thread to moderator Post Follow-up to this message
Old Post
Stefan Waldmann
07-08-04 02:06 PM


Re: Convert Date to String
On Thu, 8 Jul 2004 15:25:43 +0400, "Java" <Dhanesh81@intnet.mu> wrote
or quoted :

>How do we convert convert the String to a date using the DateFormat Class
>
>for e.g
> Converting the String dateofbirth to a date

see http://mindprod.com/jgloss/calendar.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Report this thread to moderator Post Follow-up to this message
Old Post
Roedy Green
07-08-04 09:04 PM


Re: Convert Date to String
On Thu, 08 Jul 2004 14:02:16 +0200, Stefan Waldmann
<stefan.k.waldmann@vr-web.de> wrote or quoted :
 
>
>Oops, misspelt your name, sorry Roedy :-(
>(Not a native speaker...)

I answer to anything beginning with R.  In person, people rarely get
my name right. it comes out Rod, Roddy, Rudy.

If you are interested in hearing how I say it, see
http://mindprod.com/roedy.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Report this thread to moderator Post Follow-up to this message
Old Post
Roedy Green
07-08-04 09:04 PM


Re: Convert Date to String
Roedy Green wrote:
> On Thu, 08 Jul 2004 14:02:16 +0200, Stefan Waldmann
> <stefan.k.waldmann@vr-web.de> wrote or quoted :
>
> 
>
>
> I answer to anything beginning with R.

:) remember to make exception when R is for Rawat.

> In person, people
> rarely get my name right. it comes out Rod, Roddy, Rudy.
>
> If you are interested in hearing how I say it, see
> http://mindprod.com/roedy.html
>

Another page roedygreen.html reads.

> Roedy Green The author of this glossary and prolific
> poster on Internet in the comp.lang.java.* newsgroups. To
> see any of my postings just ask Dejanews

change that to google.
---------

Just curious. Which other languages did you learn, in which
sequence?

--
Rawat

who keep a permanent record of nearly everything anybody
says on the net. You can search for me as roedy at bix.com,
roedy at oberon.ark.com or most recently as roedy at
mindprod.com. I don't post my current email. address in text
form to avoid spam, though you can see it by click the word
email.




Report this thread to moderator Post Follow-up to this message
Old Post
V S Rawat
07-09-04 08:57 AM


Re: Convert Date to String
On Fri, 09 Jul 2004 01:07:38 +0530, V S Rawat <vsrawat@hclinfinet.com>
wrote or quoted :

>Just curious. Which other languages did you learn, in which
>sequence?

Hmm. Fortran II on the IBM 1620 when I was 15 years old a sort of
child astronaut allowed in with the guys in the white coats behind the
locked doors (it was indescribably exciting),  assembler for the IBM
7044, Algol 60, Act-V, assembler for the LGP-30, Algol-68, PL-1,
COBOL, Pascal, assemblers for many machines,  MINC Basic, APL, Forth,
Abundance, C, C++, Java.  I played around with many more. I worked for
a while at UBC on differential equations. One of the perks was a
library card to the computer science library where there were hundreds
of books on obscure languages.  I was in heaven.

Forth was the most fun. Abundance is the most productive.  Eiffel was
the most beautiful.  Java is what I am mostly using now. Bali is what
I hope to be coding in some day.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Report this thread to moderator Post Follow-up to this message
Old Post
Roedy Green
07-09-04 08:57 AM


Sponsored Links




Last Thread Next Thread Next
Pages (2): [1] 2 »
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:27 AM.

 

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.