| | |
date format
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
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))); ....
•
•
•
•
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
Views: 472 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Java
6 android api apple applet application arguments array arrays automation binary bluetooth bold byte c++ chat class classes client code component coordinates database datagram doctype draw eclipse educational error event exception file fractal froglogic game givemetehcodez graphics gui helpwithhomework html ide ideas image ingres input integer internet intersect ip j2me java javaexcel javaprojects jmf jni jpanel jtextarea julia linux list loop map method methods mobile netbeans newbie nextline number object oracle pong print problem program programming project recursion recursive scanner screen sell server set size sms socket sort sql string swing test threads time transfer tree user web websites windows






