wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Date Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Date Question" Watch "Date Question" New topic

Date Question

Vineela Devi
Ranch Hand

Joined: Dec 20, 2003
Posts: 191
Hi All,

How can i get the System Date(current Date ) in yyyy-mm-dd format?

Help me pls.

Thanks in Advance

arnel nicolas
Ranch Hand

Joined: Dec 16, 2003
Posts: 149
hi, i guess you posted you are in the wrong forum but try
to study the code below which might help you.

import java.util.*;
import java.text.*;

class DisplayDate{

public static void main(String[] args) {
System.out.println(new SimpleDateFormat("yyyy-mm-dd").format(new Date()));

Swamy Nathan
Ranch Hand

Joined: May 16, 2004
Posts: 187
Anothet thing whenever you start thinking up about formatting dates then u also end up trying to externalize all ur messages into resource bundles so also look up the internationalization tutorial from sun.

You should start using this especially the MessageFormat class
It is sorta covered in the JavaRanch Style Guide.
subject: Date Question
Similar Threads
How can I get sysdate in java?
about dataBase books
WA #1.....word association
Head First Design Patterns Release Date
Another format check :P