473,473 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

java.sql.Date

14 New Member
How can I set the current date in the format 2007-06-06 for java.sql.Date?
Jun 7 '07 #1
4 3459
DeMan
1,806 Top Contributor
search java calendar on the net.....it should explain lots
Jun 7 '07 #2
veremue
14 New Member
search java calendar on the net.....it should explain lots

thank you I have done so. i have a small issue now. the following code segment is producing a wrong date on the year.

code: java

int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
int day = cal.get(Calendar.DAY_OF_MONTH);

....

I am setting the date as below:

preqL.setReceiptDate(new java.sql.Date(year,month,day));//preqL is a local object

when I print it in the jsp it shows:: 3907-06-07 instead of 2007-06-07
Jun 7 '07 #3
r035198x
13,262 MVP
thank you I have done so. i have a small issue now. the following code segment is producing a wrong date on the year.

code: java

int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
int day = cal.get(Calendar.DAY_OF_MONTH);

....

I am setting the date as below:

preqL.setReceiptDate(new java.sql.Date(year,month,day));//preqL is a local object

when I print it in the jsp it shows:: 3907-06-07 instead of 2007-06-07
How did you set the date?
use setReceiptDate(Date.valueOf(stringDate)) to set the date.
Jun 7 '07 #4
DeMan
1,806 Top Contributor
when I print it in the jsp it shows:: 3907-06-07 instead of 2007-06-07
1) follow R0's advice
2) sounds like the date you used only wants # of years after 1900 ie 107......
Jun 7 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
17
by: | last post by:
Hello, I need to send a Java date (milliseconds since the epoch 1970-01-01 00:00:00.000 GMT) through a socket to a C++ app and reconstruct exactly the same date in the C++ app as in the Java...
2
by: Michael | last post by:
Running DB2 v7 UDB ("DB2 v7.1.0.93", "n031208" and "WR21333") on Windows XP, I am unable to find out why the "Build for Debug" option within Stored Procedure Builder is not enabled on Java stored...
2
by: LandWolf | last post by:
Hi, I have a Web services write in Java and I want to write a client in C#. My web services work with Weather prevision. Hence, I set a date and my web services return the prevision for that date....
6
by: rohayre | last post by:
Im a long time java developer and actually have never done anything with java scripting. I'd like to write a short simple script for calculating a date in the future based on today's date and a...
0
by: TraceyAnnison | last post by:
I wonder if you can help me - I'm new to this, and working in a project that has already been configured to work with Axis. We have a Java project built with the Spring framework, in order to...
7
helpwithcode
by: helpwithcode | last post by:
Hi people, I am just learning java.I have been creating a project which involves JDBC Connectivity.I find that the statements, String string_dob=text_dob.getText(); //Converting string to...
3
by: Nick048 | last post by:
Hi to All, In order to create a Date Picker that I need to use in Oracle forms, I have modified some element in the source of original calendarPJC provided from Oracle. Following the...
3
by: Joshepmichel | last post by:
Please to help me to following problem I want to do this 1. create Table Name MEMBER on the Database Name "mytestdb", 2. Add the Values to the Table through the Key board Inputs during running...
19
by: robtyketto | last post by:
Greetings, I have the following code below which allows the date to be added via a JDBC connection as a STRING. The value of dateString is inserted into the MS ACCESS database. What is the...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.