Solved

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

Posted on 2009-04-09
1
219 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
1 Comment
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 24113192
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

705 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now