|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Date conversion
how do i do a check to see if the string (in this case the date) user entered is in YYYY-MM-DD format. if it is not in this format, then it should convert to this format.
eg: user entered 16-09-2002, it should be converted to 2002-09-16. however if the user entered 2002-09-16, then no conversion is needed. pls help asap.. |
|
#2
|
|||
|
|||
|
Use http://java.sun.com/j2se/1.4/docs/a...rmat.html#parse(java.lang.String) then spit the date out however you want.
|
|
#3
|
|||
|
|||
|
i dun really understand what the website is trying to do. can you show me the codes??
|
|
#4
|
|||
|
|||
|
Code:
dateString = new SimpleDateFormat( "yyyy-MM-dd" ).format( new SimpleDateFormat.parse( "16-09-2002" ) ); You'll need to import java.text.SimpleDateFormat. |
|
#5
|
|||
|
|||
|
how come i get this error: Class java.text.SimpleDateFormat. parse not found, even though i have imported the SimpleDateFormat class???
|
|
#6
|
|||
|
|||
|
Sorry,
Code:
new SimpleDateFormat.parse( "16-09-2002" ) Code:
new SimpleDateFormat().parse( "16-09-2002" ) |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > Date conversion |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|