date 5 « Date Time « Java Data Type Q&A





1. date filtering in JAVA    coderanch.com

i am looking for date filtering :- I have some items with date and i need to put them as "today" "tomorrow" "This week" "Next week" "Latter" "Past Dated" . what is the best approach. 1) Take out number of days between item date and today double longdiff = date.getTime() - today.getTime(); double floatdiff = longdiff / (1000.0 * 60 * ...

2. Needed logic for java date    coderanch.com

Hi All, Am having a calendar control for my page where am getting date in dd/mm/yyyy format which is taken as a string. And am converting that string to DateFormat and then to Calendar. Below is the code which I have used String args="26/8/2009"; DateFormat df = new SimpleDateFormat("dd/MM/yyyy"); Calendar date = Calendar.getInstance(); Date today = df.parse(args); date.setTime(today); 1) I need ...

3. Date Problem in Trail version of my Java application    coderanch.com

Dear Sir/mam, I have designed the trial version for my standalone java application, i compared the system date with user's registration date when the user installs the software, the problem came in as the user changes the system date the expiry date of the software advances or can be said is affected,can any one help me in solving my problem,so that ...

4. how to get old date    coderanch.com

5. Displaying the Date - Issue    coderanch.com

Hi Eveyone, Can you please anyone give me solution for this below issue. I am trying to print the System current date. In java code it is printing correct date, while displaying on the browser TextFiled it is showing the previous date. For this i used the code like String Date_Format = "MM-dd-yyyy"; Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new ...

6. Catching a Bad Date    coderanch.com

In the following code on of the dates from the remote data is 10/15/0209. The following line throws a nullpointerexception when this date is reached. The resultset says the value of rs.getString(3) is null. How can I catch this error so the process can continue and complete? What I have tried here does not work because the error happens before the ...

7. How to make Date Immutable    coderanch.com

Yes, that is the standard method for new values for immutable classes. Simple examplepublic final class Point /* Notice that a truly immutable class should be labelled final */ { private final int x; private final int y; private int hash; public Point(int x, int y) { this.x = x; this.y = y; hash = 0; }//end constructor public int getX() ...

9. about subtract dates    coderanch.com

thank you sir , i found it Calendar cal1 = Calendar.getInstance(); Calendar cal2 = Calendar.getInstance(); // Set the date for both of the calendar instance cal1.set(yy,mm,dd); cal2.set(yy,mm,dd); // Get the represented date in milliseconds long milis1 = cal1.getTimeInMillis(); long milis2 = cal2.getTimeInMillis(); // Calculate difference in milliseconds long diff = milis2 - milis1; // Calculate difference in seconds long diffSeconds = ...





11. Help for future date    coderanch.com

The numbers you are doing the math with (150 * 1000 * 60 * 60 * 24) are all integers, which means the result will be an integer. Integers have a max value which this calculation exceeds, so it wraps around and becomes negative - and probably comes back up to being just a few hours ahead instead of a lot ...

12. Processing & Altering Date XMLGregorianCalendar    coderanch.com

Hi All, I am new to Java & am tring to use XMLGregorianCalendar to get a date in format of "2009-10-07T06:00:00+0530" Right now am using new DatatypeFactory.newInstance().newXMLGregorianCalendar(GregorianCalendar(System.currentMilles())); to get the date in this said format. I am unaware of how to update the date value by a day or a minute .. using Duration API eg ... "2009-10-07T06:00:00+0530" to "2009-10-07T06:01:00+0530" It ...

13. IE 6 problem with Dates?    coderanch.com

I have a strange issue while comparing dates. I have startDate and endDate and I'm trying to do a validation on them, startDate

14. Date increment in java??    coderanch.com

15. Getting the right Date    coderanch.com

I've written a class that can determine the date if you give it the year and the weeknumber: public class WeektoDate { GregorianCalendar cal; int date, month, year; public WeektoDate(int week, int jaar) { cal = new GregorianCalendar(); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.set(Calendar.YEAR, jaar); cal.set(Calendar.WEEK_OF_YEAR, week); cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); } public String getDate() { date = cal.get(Calendar.DAY_OF_MONTH); month = cal.get(Calendar.MONTH); month++; year = cal.get(Calendar.YEAR); return ...





17. Date Display In MM/dd/yyyy    coderanch.com

18. Date comparision in java    coderanch.com

So, you have those dates as strings? First, you'll have to convert them to java.util.Date objects. You can do that using java.text.SimpleDateFormat (read the API documentation for that class). But if you don't know what the format of the second date is, it is going to be very hard. The computer can't magically figure that out for you... Note that dates ...

19. confusing output of a date    coderanch.com

sorry i cant express my thoughts too much.... i cant speak enough english very well ... so i look my files and found this one... private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { int year, month, day; GregorianCalendar cal; SimpleDateFormat sdf; System.out.print("Enter Year: "); year = Integer.parseInt(br.readLine()); System.out.print("Enter Month:"); month = Integer.parseInt(br.readLine()); System.out.print("Enter ...

20. Problem or bug with the method getTime() from java.util.Date    coderanch.com

I was coding a method that gets the number of days between two dates. When I was testing the method I found that sometimes it returns a result that differs with the correct answer in 1 day. I check step by step my method and I found this problem. I don't know what I am doing wrong, but I don't have ...

21. Java Date    coderanch.com

Im not sure if I should have posted this in the begginer part or the general part, but here we go. Basically, I need a way of looping through dates. i have a date of type Date, and i want to cycle through the previous 7 days. I could do this by taking the day part of the date, cycling through ...

22. date    coderanch.com

Swastik, your solution has a bug: it isn't daylight savings proof. A day does not always have 24 hours; when switching from winter time to summer time it's 23 hours and when switching from summer time to winter time it's 25 hours. It's better to use class Calendar's date arithmetic methods, which take daylight savings into account. And you can use ...

23. Date in java    coderanch.com

Hi, I have a requirement to create periods from current date. Ex: 1 to 15 jan - 1st period 16 to 31 jan - 2 nd period 1 to 15 feb - 3 rd period... so on upto 6 periods Once my period moved out of 6th position that is on 7th, I have to get that date and last date ...

24. Date object    coderanch.com

25. trying to build a Pattern (Pattern and Matcher) for a Date (eg form: 08Apr)    coderanch.com

Hi guys, I'm using the Pattern and Matcher and wish to know how to write a correct Pattern. I have a line of text and in it I have a date (well almost) example: String s = "The brown fox jumped on 08Apr over the fence"; The 08Apr is the date and it appears in many instances like this in my ...

27. getting system date    coderanch.com

28. Question about system date    coderanch.com

Hello I am not really sure under which topic this should go... I have a java code that uses the system date. This works normally on a development server (running on Linux), however in System server (also with Linux) the system date is 2 days in advance... I have check the dates in Linux, and they both match, so I am ...

29. Date not working    coderanch.com

Hi, Following is the code for adding date public boolean addDate(int iDate) { Calendar cal = Calendar.getInstance(); cal.set(2009,02,01); cal.add(Calendar.DATE, iDate); // Add days in Dates in Calendar System.out.println("Date :"+cal.get(Calendar.DATE)); System.out.println("Month :"+cal.get(Calendar.MONTH)); System.out.println("Year :"+cal.get(Calendar.YEAR)); return true; } calling the function. addDate(30); But the output is giving wrongly, previously for couple of months it was working fine, but now I don't understand why ...

30. Printing date    coderanch.com

31. Date Formate Problem    coderanch.com

32. java.util.Date    coderanch.com

33. combo question: date formats and general question about exceptions    coderanch.com

Hi, I'm writing a web app that uses dates, and in some cases I have the user enter dates in an html form and then I need to convert that input to a java date format...I usually use GregorianCalendar. First...is that the best date format? Or is SimpleDateFormat better? I use GregorianCalendar mainly because the books and tutorials I came across ...

34. dates between two dates    coderanch.com

35. How to get yesterday's business date    coderanch.com

36. Date Comparision    coderanch.com

37. Date Comparisons    coderanch.com

38. Keeping up to date    coderanch.com

39. Why Would new Date Cause an Exception    coderanch.com

Has any one got an idea why the last line of code in my example would cause a NullPointerException? /* * Created on Apr 28, 2009 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.FAIWebApp.docs; import java.io.FileOutputStream; import java.io.IOException; import java.text.Format; import ...

40. ralated to date    coderanch.com

Can you be more specific on what precision and accuracy you need? For example, a lot of applications really need to know that one date is earlier than another, at millisecond precision or better, but don't actually care about the accuracy of the time, it could be even an hour off of "official" time, and the application would work just fine. ...

41. up to Date() ?    coderanch.com

public Date(int year, int month, int date) Deprecated. As of JDK version 1.1, replaced by Calendar.set(year + 1900, month, date) or GregorianCalendar(year + 1900, month, date). Allocates a Date object and initializes it so that it represents midnight, local time, at the beginning of the day specified by the year, month, and date arguments. Parameters: year - the year minus 1900. ...

42. Quick question about the date class    coderanch.com

So i was told to create a credit card class and include the date class in it. I have a tester program to check through my created class. The only test i have failing is test 11. It says that getDateAccountOpened changes date that account was opened. Not to sure about what is going on. A little guidence would be awesome. ...

43. java date beginner question    coderanch.com

Hello, java world! I have a project in which i need to work with the date and time classes in java. This is where i always fails. I have a calendar object that will represents dates only not hours minutes and seconds. This date object will start from the year 1900 or rather using the date format 1900-01-01. I need to ...

44. Problems handling the Date Class.    coderanch.com

Hi all, I had a doubt while trying to manipulate the Date class.I'm retreiving values from the database that are of the form "dd-MMM-yyyy" e.g 06-Jun-2011 .The problem causing code is as below . String strdateVar= rs.getString("REP_DATE");//Output of the Form dd-MMM-yyyy(06-Jun-2011) System.out.println("Before formatting"+strdateVar); SimpleDateFormat d1=new SimpleDateFormat("dd-MMM-yyyy"); Date dtVar=d1.parse(strdateVar); System.out.println("Before setting to bean Date--"+dtVar);// Value is of form Mon Jun 06 00:00:00 ...

46. puzzle of the date output is different, 1988-07-14 will change to 1988-07-13    coderanch.com

import java.text.ParseException; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class Test { public static void main(String[] args) throws ParseException { do1(); System.out.println(); do2(); System.out.println(); do3(); System.out.println(); do4(); } public static void do1() throws ParseException { TimeZone.setDefault(TimeZone.getTimeZone("CTT")); java.sql.Date date = java.sql.Date.valueOf("1988-07-14"); dodo(date); } public static void do2() throws ParseException { TimeZone.setDefault(TimeZone.getTimeZone("CTT")); java.sql.Date date = java.sql.Date.valueOf("1978-07-14"); dodo(date); } public static void do3() throws ...

47. Change date for other languages ?    coderanch.com

I have a little doubt, when I execute this simple code, he return for me the String in English, in the case just the Month, but I wanted in portuguese. Caso someone can help me, thanks a lot. import java.text.*; import java.util.*; public class MonthFormat { public static void main(String args[]) throws ParseException { String s; String s1; String s2; String ...

48. problem in incrementing date    coderanch.com

here is the code import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; public class PracDate { public static void main(String[] args) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("dd-mm-yyyy"); GregorianCalendar gc = new GregorianCalendar(); java.util.Date d = sdf.parse("12-11-2003"); gc.setTime(d); System.out.println("Issue Date = " + sdf.format(d)); int dayBefore = gc.get(Calendar.DAY_OF_YEAR); gc.roll(Calendar.DAY_OF_YEAR, +42); int dayAfter = gc.get(Calendar.DAY_OF_YEAR); System.out.println("No Of Days =" +dayAfter); //if ...

49. Java date problem    coderanch.com

Hello. I have a problem concerning dates in Java and I have no idea what to use. I have a program which deals with contracts. A new contract can be made on at most 2 years. The user must isert date when contract was made (let's call it "initial") and the date when the contract expires (lets call it "final"). My ...

50. increasing the date in java as whole    coderanch.com

Hi all, How can we increase the date in java as whole. I mean to say that suppose my current date is 30/09/2011 then after increasing the date by 1 it should directly give 1/10/2011 not 31/09/2011 or if i increase by 2 it should give 02/10/2011 not 01/09/2011. what i am trying is below. Is there any functions where month ...

51. Java Date problem    coderanch.com

In java web application while storing the date into a database and rendering from the database do we need to convert the date in to UTC format in DB i have the datefield datatype as datetime The problem i am getting is the date stored in to the DB properly but while rendering its giving one day lesser than the current ...

52. Date.before() Function    coderanch.com

53. Is it possible to generate a random date with gregorian calendar?    coderanch.com

Michael's code does produce random dates. It doesn't produce all dates with equal probability (as you say it is unable to produce some dates at all) but then that wasn't a stated requirement. Your suggestion works much better at producing all dates with equal probability, but when you render those dates in a particular time zone then days when daylight saving ...

54. Date FUnction in java    dbforums.com

55. Displaying date    java-forums.org

56. Addition of period to dates    java-forums.org

57. DATE in JAVA    java-forums.org

hi, my program needs to run a particular process only between say, 9 am to 5 pm every day. and if the system time is not between this, the if shud not be executed. how to obtain such a functioanality. I would prefer the start time and end time to be configurable , to be picked up from a properties file. ...

58. Help how to write the date    java-forums.org

59. Date application - help please!    java-forums.org

I am trying to complete the following but have no idea where to start. Help please. I am very new to java and only have a basic understanding. Thanks. Write an application in which the user can enter a date using digits and slashes ("2/4/2010"), and receive output that displays the date with the month shown as a word (such as ...

61. Earlier date    java-forums.org

Hi I have written the following programe to compare two dates and give the earlier date. Java Code: import java.util.Scanner; public class Dates { public static void main(String[] args){ //Declare object of Scanner class Scanner scan = new Scanner(System.in); //Declare variables int d1,m1,y1; int d2,m2,y2; //Prompt user to enter the first date System.out.print("Enter the first date : " ); d1 = ...

62. date subtraction    java-forums.org

i am fetching the date in mm-dd-yyyy hh:mm format from the database......now the mm-dd-yyyy is sane in both the case......i have to calculate the the difference between hh:mm of the two can "-" operator be use directly on the Date object or should i convert them in string or integer format :confused:

63. How to create a Date feature in Java?    java-forums.org

Hey everyone, i'm new to Java and no nothing really just basic concepts in editing and stuff if I would have a code... but I'm looking for a simple code just a date function so it displays todays date for everyday, and the option for me to change the font size, colour and style? much appreciated!! thanks!

64. Print out the date    java-forums.org

65. Flickr Api - trouble return Date objects    java-forums.org

Hi, I am very new to Java, so I'm fairly sure that my problem is a language and procedural one as opposed to anything to do with the flickrJ API. I am fairly sure that my issue is a casting one, although again I'm not sure of that. I am able to post code but again I'm not sure what parts ...

66. Help creating a Date class    java-forums.org

Ok. Im ignoring my other thread becuase its gotten too messy to follow. You said earlier i may be overthinking my program, but i feel like i need to do it that way. Basically, if you look in my advanceDate method, i need to check if they user enters the last day of a month, example 31 of january. If they ...

67. Confused about date objects    java-forums.org

68. Date problem in MSAccess    java-forums.org

69. Percentile by date    java-forums.org

Hi all, I have just started learning Java (reading Sun's tutorial) because I have been working on a project in Microsoft Access & Excel which those applications cannot seem to handle. I have seen some Java programs before and think Java could more efficiently address my problem, but I currently have no idea what I'm doing and would very much appreciate ...

70. Can't get my date math to work    java-forums.org

calcButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy"); Date date = (Date)formatter.parse(startDateFld.getText()); startDate.setTime(date); } catch (ParseException e) { System.out.println ("Exception: " + e); } int days = Integer.parseInt(daysFld.getText()); endDate = startDate; endDate.add(Calendar.DAY_OF_YEAR, 5); endDateFld.setText(endDate.get(Calendar.MONTH) + "/" + endDate.get(Calendar.DATE) + "/" + endDate.get(Calendar.YEAR)); } }); . . . Calendar startDate = Calendar.getInstance(); Calendar endDate = ...

71. Date operations    java-forums.org

Hi I need to convert a string to Date to build a query. Following are the values which i am recieving from front end String date = 06/21/2010 while running the query on database table the date should be in following format 2010-06-21 18:18:02.732 Here is what i tried Date = Date.replace('/','-'); String pattern = "yyyy-MM-dd"; SimpleDateFormat sdf = new SimpleDateFormat(pattern); ...

72. Gregorian calendar multiple dates    java-forums.org

Is it possible to create a GregorianCalendar object and set multiple dates in it? For creating intervals of time in it, and then associate it with a person. This is to be used to create a vacation calendar so multiple intervals. If you have any good idea or other approach to the problem, please share!:o

73. date is not working properly    java-forums.org

Following is the code for adding date public boolean addDate(int iDate) { Calendar cal = Calendar.getInstance(); cal.set(2009,02,01); cal.add(Calendar.DATE, iDate); // Add days in Dates in Calendar System.out.println("Date :"+cal.get(Calendar.DATE)); System.out.println("Month :"+cal.get(Calendar.MONTH)); System.out.println("Year :"+cal.get(Calendar.YEAR)); return true; } calling the function. addDate(30); But the output is giving wrongly, previously for couple of months it was working fine, but now I don't understand why the ...

74. Date represented by an integer?    java-forums.org

I am making a program that reads some text files and takes some input from it. Among them are some dates and some values for each of those dates. But the program which generated the text files seems to have had an error in it, because some of the dates are integers instead of the expected dd/mm/yyyy format. Are there an ...

75. Date highlight    java-forums.org

Hi guys, How are you all. I am a beginner java programmer, and i am trying to get my program to highlight the date which has been given in the month by a command line argument. For instance, there are 3 command line arguments; the first is the start day of the month, second is the month, and the third is ...

76. Date() cannot! why?    java-forums.org

77. Clear the Date object for cron    java-forums.org

public class GetCalendarServlet extends HttpServlet { static SimpleDateFormat df = new SimpleDateFormat("MMM/d(EEE)HH:mm"); /** * Gets the current date each time invoked. * @return the date now as a formatted string */ protected String getTodayString() { return df.format(new Date()); } /** Sample invocation of the getTodayString() */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String todayString = getTodayString(); } ...

78. using dates in java    java-forums.org

hi there, i require to ask the user to enter the date in the format dd/mm/yyyy. then the program should add 3 days with date provided by the user, and the result is output in the screen. I researched a bit, and i discovered something about a DATE CLASS .. however i tried to avoid using it.. and went to finding ...

79. Setting a Date?    java-forums.org

80. Java Date Calculator    java-forums.org

hey guys , total java noob here but am trying write a program that will count days from a certain inputted date(thorugh Joptionpane) here's the code I know I'm prob doing a millions things wrong so a point in right direction would be greatly appreciated. basically this takes in a date and adds firstly 182(26 weeks) and then 294(42 weeks) to ...

81. Is their any method which converts a Julian date to an actual date.    java-forums.org

Hi I have to program , given a number say 145 i should get back 25-May-06 Can any one tell me ,is their any built in method which takes a julian date and gives an actual date . or any help with, how to code to get the actual date Thanks renu

82. How to write process to excute batch job on particular date.    java-forums.org

Hi every body, I have some question about how i going to write process to execute on particular date. Assumption: 1. I need to write Action class which can execute batch process. 2. It needs to has a condition. 2.1 process will go back to check the last successful run date. 2.1 when process found the date, it will start to ...

83. Another Date Problem    java-forums.org

I'm using this code within JSP so system.out doesn't seem to work. However if I set a string to the getParameter thing, and then print it out using jsp i get a list of dates like "Mon Dec 27 00:00:00 GMT 2010" Can you explain how to use DateFormat.parse()? I'm getting all sorts of errors and I've even looked at the ...

84. Java Date input from User,    java-forums.org

import java.util.*; import java.text.*; public class wy2 { public static void main(String[] args) { Date now = new Date(); Scanner sc = new Scanner(System.in); System.out.print("Enter Date: "); String ind = sc.nextLine(); DateFormat df = new SimpleDateFormat("dd/mm/yyyy"); try { Date d = new Date(); d=df.parse(ind); } catch(ParseException e) { System.out.println("Unable to parse " + ind); } DateFormat df3 = DateFormat.getDateInstance(DateFormat.LONG); String s3 ...

85. determine if account has child opportunities within specific date ranges    java-forums.org

I'm using the salesforce language APEX which is derived from Java. I hope it is okay to post in this forum since APEX is almost identical to Java. If not, my apologies and feel free to ignore this post. I've created a batch program that loops over all accounts and then loops over each accounts related child opportunities. As I'm looping ...

86. passing date into parameter    java-forums.org

public class Persoon { /* * Fields */ private String achternaam; private String voornaam; private char geslacht; private Date geboortedatum; /* * Constructor * Velden van Persoon initialiseren */ public Persoon(String persoonAchternaam, String persoonVoornaam, char persoonGeslacht, Date persoonGeboortedatum) { achternaam = persoonAchternaam; voornaam = persoonVoornaam; geslacht = persoonGeslacht; geboortedatum = persoonGeboortedatum; } ....

87. how to write process to execute batch job on particular date.    java-forums.org

Hi every body, I have some question about how I am going to write process to execute batch job on particular date. Assumption: 1. I need to write Action class which can execute batch process. 2. It needs to has a condition. 2.1 process will go back to check the last successful run date. 2.1 when process found the date, it ...

88. How to check available dates for exam?    forums.oracle.com

89. SCJP Expiry date formate    forums.oracle.com

91. Unparsable date exception    forums.oracle.com

92. doubt voucher expiry date    forums.oracle.com

I have read that other post. I can't believe it, which is to say I have one doubt. BigDaddyLoveHandles?! What does he possess that I don't? Besides the supernumerary fingers, web toes and third nipple. I am having hairy back also! Yes, he is SCJP. Formerly the world's heaviest as he likes to chat it up. I know I have failed ...

93. Expiry date of SCJP voucher    forums.oracle.com

I have purchased a SCJP voucher. In that voucher the expiry date is mentioned as April 2008. But there is a seal on top of it, saying that the expiry date is Aug 31 2007. So I am a little bit confused. Is there any way to know the expiry date from sun website, giving the voucher number or so?

94. Increasing the date!!    forums.oracle.com

95. viewing records ordered by date    forums.oracle.com

actually i have inserted the "date" in msaccess database table using "dd-mm-yy" format now i want to view records of that table in ascending order of the date so i wrote the query: Select * from TRANSACTIONS order by aco_date ASC,aco_time ASC"; but the problem is if i write this it compares the day first and then the month and then ...

96. System date    forums.oracle.com

sigh It's pretty clear that [_sam-4-u_|http://forums.sun.com/profile.jspa?userID=1054327], [_gif-sa-as_|http://forums.sun.com/profile.jspa?userID=983621] and [_shino_|http://forums.sun.com/profile.jspa?userID=999047] are all actually the same person engaging in a pathetic display of duke fraud. gif-sa-as, can you just knock it off please. You're very bad at doing the fraudulently for one thing but more than anything, it's just so pointless. And there will be oh, so much complaining. And for what? Really? ...

97. search patient by patient id , first name , last name , date of birth    forums.oracle.com

public PatientData[] searchPatient(PatientData obj) { int patientid = obj.getPatientId(); String firstname = obj.getPatientFirstName(); String lastname = obj.getPatientLastName(); String dateofbirth = obj.getPatientDateOfBirth(); String url = "jdbc:mysql://localhost/mokshadatabase"; String user = "root"; String password = "password"; String jdbcDriver = "com.mysql.jdbc.Driver"; PatientData list[] = null; int i = 0; String query = null; try { Class.forName(jdbcDriver).newInstance(); Connection cn = DriverManager.getConnection(url, user, password); //---------- PATIENT ID ...

98. problem with java.util.Date    forums.oracle.com

"Deprecated" means that you can use it, but it's discouraged. When you see that, check the API documenation to see if another method or technique is suggested. Or you can just ignore the warning. It may come back to bite you in the *** eventually, but maybe you can live with that.

99. getting System date    forums.oracle.com

100. Dates in Java    forums.oracle.com

public class AgeCalculation { public static void main(String[] args){ try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter ur birthdate in dd/MM/yyyy format "); String birthDate = br.readLine(); birthDate = getYYYY(birthDate); DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); Date date = new Date(); String currentDate = dateFormat.format(date); currentDate = getYYYY(currentDate); int resultAge = Integer.parseInt(currentDate) - Integer.parseInt(birthDate); System.out.println("Your Age as of now "+resultAge); } catch(Exception ...