| | |
date format
![]() |
•
•
Join Date: Aug 2008
Posts: 40
Reputation:
Solved Threads: 0
Can you help me with source code to get the date 1 jan 2009 in the format
01 01 09.
Actually I've to form a verification id for issuing gatepass which uses last two digit of the year,then net two digit consist of month and next three digit consist of number from 001 to 999 which increment by 1.
Please help me it's urgent.
01 01 09.
Actually I've to form a verification id for issuing gatepass which uses last two digit of the year,then net two digit consist of month and next three digit consist of number from 001 to 999 which increment by 1.
Please help me it's urgent.
Last edited by coolbuddy059; Jun 10th, 2009 at 6:42 pm.
SimpleDateFormat class is needed
Java Syntax (Toggle Plain Text)
...... String yourdate="12-Aug-2009"; String currformat="dd-MMM-yyyy"; SimpleDateFormat fd=new SimpleDateFormat(currformat); Date d1=fd.parse(yourdate); System.out.println(d1); String newformat="dd-MM-yyyy"; fd.applyPattern(newformat); StringBuffer b=new StringBuffer(); System.out.println(fd.format(d1,b,new FieldPosition(0))); ....
Failure is not fatal, but failure to change might be. - John Wooden
•
•
•
•
SimpleDateFormat class is needed
Java Syntax (Toggle Plain Text)
...... String yourdate="12-Aug-2009"; String currformat="dd-MMM-yyyy"; SimpleDateFormat fd=new SimpleDateFormat(currformat); Date d1=fd.parse(yourdate); System.out.println(d1); String newformat="dd-MM-yyyy"; fd.applyPattern(newformat); StringBuffer b=new StringBuffer(); System.out.println(fd.format(d1,b,new FieldPosition(0))); ....
Java Syntax (Toggle Plain Text)
//fd.format(d1) System.out.println( fd.format(d1) );
Check out my New Bike at my Public Profile at the "About Me" tab
![]() |
Similar Threads
- Want Date Format in dd/mm/yyyy in ASP.Net With C#. (C#)
- Excel vba 6.0 copy date cells date format (Visual Basic 4 / 5 / 6)
- Change date format (Oracle)
- Inserting date in format DD-MM-YYYY in MySQL (MySQL)
- Date format in MS Office 2000 (Visual Basic 4 / 5 / 6)
- VBA Date Format (Visual Basic 4 / 5 / 6)
Other Threads in the Java Forum
- Previous Thread: J2ME Certification Tutorial
- Next Thread: The e.getSource() method from ActionEvent e in a listener
| Thread Tools | Search this Thread |
2dgraphics account android api apple applet application arguments array arrays automation banking binary binarytree bluetooth chat chatprogramusingobjects class client code color component count database derby design eclipse eclipsedevelopment encryption error fractal game givemetehcodez graphics gridlayout gui html ide if_statement image input integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel julia keyword linux list loop macintosh map method methods midlethttpconnection mobile netbeans newbie nullpointerexception object open-source os problem producer program programming project projectideas property read recursion reference replaysolutions ria scanner search server set size sms sort sourcelabs splash sql stop string swing testautomation threads transforms tree ui unicode validation windows






