A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java API - to get next year
Shadab F Hashmi
Joined: Feb 13, 2006
Sep 12, 2006 18:30:00
I have a requirement where i have a date like "2006-08-21 09:53:58.0", so i need to get the last date of the next year like "2007-12-31 09:53:58.0".
Does Java API provide any method where if i give the date like "2006-08-21 09:53:58.0" and output i get "2007-12-31 09:53:58.0".
Can anyone please mail me the code.
Thanks inadvance for all the help.
Author and ninkuma
Joined: Jan 10, 2002
Sep 12, 2006 18:39:00
Check out the
[ September 12, 2006: Message edited by: Bear Bibeault ]
Asking smart questions
Books by Bear
Joined: Sep 13, 2006
Sep 13, 2006 14:37:00
I think I would use a
to construct a date:
(int year, int month, int date, int hour, int minute, int second) Constructs a
with the given date and time set for the default time zone with the default locale.
Then use the set() function of the Calendar class
set(int year, int month, int date)
Sets the values for the fields year, month, and date.
To set the new year, month and day values.
I agree. Here's the link:
subject: Java API - to get next year
Question about Calendar
Portal Server v6.0 Initialization Problem
Query problem with MySQL 5
I have some problems
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014