File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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
I agree. Here's the link:
subject: Date Question
jQuery in Action, 3rd edition