This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes SimpledateFormat format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "SimpledateFormat format" Watch "SimpledateFormat format" New topic
Author

SimpledateFormat format

James Basller
Ranch Hand

Joined: Sep 07, 2008
Posts: 58
Hi,

I have a long value which I need to convert in CCYYMMDD format.

I have looked in to API and done some googling also but failed to get answer.

I only get what is CC (Century year)

can anyone tell me how can I passed value in the SimpledateFormat's constructor so that I can format long value

like SimpleDateFormat format = new SimpledateFormat("yyMMdd");

thanks!!!
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18136
    
  39

I have a long value which I need to convert in CCYYMMDD format.



How is CCYYMMDD different from YYYYMMDD?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13884
    
  10

Try "yyyyMMdd" as the format string for SimpleDateFormat.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
James Basller
Ranch Hand

Joined: Sep 07, 2008
Posts: 58
Jesper Young wrote:Try "yyyyMMdd" as the format string for SimpleDateFormat.


Hi,

So, CCYYDDMM is same as yyyyMMdd???

Thanks!!!
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18136
    
  39

James Basller wrote:
Jesper Young wrote:Try "yyyyMMdd" as the format string for SimpleDateFormat.


Hi,

So, CCYYDDMM is same as yyyyMMdd???

Thanks!!!


Well, you are supposed to tell us. We don't know what CCYYDDMM is. But yyyyMMdd means 4 digits for the year (ie. 2009), followed by two digits for the month, followed by two digits for the day ... is that the same as CCYYDDMM?

Henry
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SimpledateFormat format
 
Similar Threads
Date formatting
Question on Dates
Oracle Timestamps and java.
string to timestamp
Converting long timestamp to utc long timestamp.