Solved

Problem when convert string to date (invalid day of Feb)

Posted on 2009-04-09
1
227 Views
Last Modified: 2013-11-23
Hi experts!

I met a problem when convert a string to date. Pls help, many thanks!
When input string represents a date with February month, invalid day of month (29 or 30, 31,..), it's automatically converted to March and day of month is (invalid input day of month - 28 (or 29)).
For example, input string "31/2/2009" will be converted to "3/3/2009"
SimpleDateFormat ts= new SimpleDateFormat("dd/MM/yyyy");
ava.sql.Date retDate = new java.sql.Date(ts.parse(inpCell.getContents()).getTime());

Open in new window

0
Comment
Question by:ncsvietnam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 24113192
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JavaFX TableView not displaying correctly 3 161
add projects t working set in maven 2 70
Eclipse for Java EE development 2 68
Coding for the first time 9 100
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question