Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-28-2008, 10:08 AM
Java Tip's Avatar
Moderator
 
Join Date: Nov 2007
Posts: 1,691
Rep Power: 5
Java Tip will become famous soon enoughJava Tip will become famous soon enough
Default Using SimpleDateFormat
We use SimpleDateFormat to format the date in the required format. The code below formats the date in yyyyMMdd form.

Code:
import java.util.Calendar;
import java.text.SimpleDateFormat;

public class TestDate {
  public static void main(String args[]){
    String DATE_FORMAT = "yyyyMMdd";
    SimpleDateFormat sdf =
          new SimpleDateFormat(DATE_FORMAT);
    Calendar c1 = Calendar.getInstance(); // today
    System.out.println("Today is " + sdf.format(c1.getTime()));
  }
}
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 07-18-2008, 09:33 AM
Member
 
Join Date: Jul 2008
Posts: 4
Rep Power: 0
thirupathik is on a distinguished road
Default
Hi,

I am getting compilation error while using SimpleDateFormat in a J2ME Application.

Can u just let me know what I can do.

Thanks
Thiru
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +2. The time now is 07:24 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org