Finding A Date

Finding A Date

My Frequency Start Date is 24-08-2012

My frequency end date - not defined

Calculation Frequency is Weekly(Sunday)

My calculation will be from 24-08-2012 to the following sunday

My question is how to find the following date of sunday

View Answers

August 24, 2012 at 12:51 PM

Here is an example that determines the date on coming sunday from the specified date.

import java.util.*;
import java.text.*;

class  GetDateExample
{
    public static void main(String[] args) throws Exception
    {
    String str_date="24-08-2012";
    SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
    Date date = (Date)formatter.parse(str_date);
    Calendar cal=Calendar.getInstance();
    cal.setTime(date);
    while(cal.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY){
        cal.add(Calendar.DAY_OF_WEEK, 1);
    }
    System.out.println("Date on coming sunday is " + formatter.format(cal.getTime()));
    }
}









Related Tutorials/Questions & Answers:
Finding A Date
Finding A Date  My Frequency Start Date is 24-08-2012 My frequency end date - not defined Calculation Frequency is Weekly(Sunday) My calculation... the following date of sunday
date_diff
date_diff date_diff alias DateTime::diff returns the difference between two... [, bool $absolute ] ) Parameters datetime - The date to compare... "Correct order"; } else { echo "Incorrect order, end date is before
Advertisements
Finding Last Modification Date of a file
Get the Last Modification Date      Get the Last Modification Date This section contains the detail about how to get the last modification date of a file
date
date   how to insert date in database? i need coding
date
date  can u tell me how to calculate difference between a user provided date and the system date in java
date
date  can u tell me how to calculate difference between a user provided date and the system date in java
date
date  i want difference between the date entered in a jtextfield and the system date in java
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
database table name birthday (DOB date); dob with DATE data type in database while...=d.getTime(); java.sql.Date date = new java.sql.Date(t); try { System.out.println(date); Class.forName("oracle.jdbc.OracleDriver"); con
DATE
DATE  I have the following as my known parameter Effective Date... of calcultion starts My question is how to find the date of Thursday This cycle... the date of all the thursdays of the given year. import java.util.*; import
finding divisors of a number
finding divisors of a number   write a c program to input a number and print all its divisors using while loop
finding divisors of a number
finding divisors of a number   write a c program to input a number and print all its divisors using while loop
finding divisors of a number
finding divisors of a number   write a c program to input a number and print all its divisors using while loop
finding java code on internet
finding java code on internet  Is there anybody to help me? i want to some java coding web sites.it is prerequest for me
finding the prime numbers
finding the prime numbers  Hi, I am a beginner to java and I have problem with the code in finding the prime numbers, can someone tell me about the problem. Thanks.   Want to know about how to find out the given
ModuleNotFoundError: No module named 'word-finding'
ModuleNotFoundError: No module named 'word-finding'  Hi, My Python... 'word-finding' How to remove the ModuleNotFoundError: No module named 'word-finding' error? Thanks   Hi, In your python
Finding duplicates using array in for loop
Finding duplicates using array in for loop  how to find the duplicates in array using for loop
Finding searching phrase of a search engine
Finding searching phrase of a search engine  how to find out searching phrase of a search engine..? like, if visitors enter the keyword to google, is is any possible to get that keyword
Finding page count in any file
Finding page count in any file  Hi, I want to find out the page count in any file (doc,ppt,pdf,image,etc...). Is there any universal API to deal with any file irrespective of the file extension.Its bit urgent. Please let me
Finding smallest value, then the next etc
Finding smallest value, then the next etc  hi, I know how to search for the smallest value index in an unsorted array so far with this: double currentValue = dist[0]; int smallestIndex = 0; for (int j
Finding shapes in digital photos - java
Finding shapes in digital photos - java  Hello, I need some hints/tips regarding some project I'm doing. The project is about finding shapes in digital photos (JPEG file). Here's what I have to do: A digital photo
Location finding error - JSP-Servlet
Location finding error  Location needs from drive name: My file uploading program has an error. It requires the location should be given from the directory name. Instead of this if only parent directory is given it shows
date format - Date Calendar
date format  how to convert dd-mmm-yyyy date format to gregorian... to convert date to calender. import java.util.*; import java.text.*; public...="19-Sep-2008"; DateFormat format ; Date date ; format = new
Date format - Date Calendar
Date format  please convert dd-mmm-yy date format to gregorian calendar date format.  Hi friend, Code related your Problem: import...]); Calendar calendar = new GregorianCalendar(pdt); Date time = new Date
date - Date Calendar
date   hi, sir i am doing student details project in swing but i am not getting current date in jtextfield in date it is giving ambigious error... label=new JLabel("Current Date: "); JTextField text=new JTextField(15
Date Formay - Date Calendar
Date Formay  Sir, How to comapare two different date format in java.  Hi friend, Code to compare two different date import...)) System.out.print("Current date(" + new SimpleDateFormat("dd/MM/yyyy"). format
Date format - Date Calendar
Date format  Hi All, I am getting a date from database as a format 2010-15-07.I need to change it to 07/15/2010 and display it on my date field.Every time i need to check the format of the date field and make sure the correct
Date limit on Dojo Date picker - Date Calendar
Date limit on Dojo Date picker  Hi all, I am using dojo for date picker in my project. When user click on date text box, date picker will pop up. Using that component user can select date. Now I trying something different. I
convert current date into date format
convert current date into date format  How to get current date and convert into date format in Java or PHP
Finding memory consuming process - Java Beginners
Finding memory consuming process  Hi, While debugging or optimizing your java application, how to find the memory consuming processes? Thanks
Finding all palindrome prime numbers - Java Beginners
Finding all palindrome prime numbers  How do i write a program to Find all palindrome prime numbers between two integers supplied as input (start and end points are excluded
i need a java code for finding typemismatch in an editor.
i need a java code for finding typemismatch in an editor.  hi im sriram, i need a java code in such a way that typemismatch code is embedded with the simple java editor. the sample output is shown below !alt text
Date related query - Date Calendar
Date related query  hi, m a new biginner of java.i m intrested in finding out d difference in d two dates "in terms of number of days "entered by d user using bufferedReader. how can i convert a string into a date object.pls
servlet code for finding the table for given number
servlet code for finding the table for given number  servlet code for finding the table for given number?   Here is a an example that accepts a number from the user and display its multiplication table using servlet. 1
Finding the longest word in a user given string
Finding the longest word in a user given string  In java, accept a string from the user and find the longest word in it.   The given code finds the longest word from the string. import java.util.*; class LongestWord
Example for Finding the Root Element in the XML File
Example for Finding the Root Element in the XML File In this tutorial, we will discuss about how to find the Root Element in the XML file. The XML DOM views an XML document as a tree-structure. Contents can be updated or deleted. You
finding the eigenvalues and eigenvector of n*n matrix in java
finding the eigenvalues and eigenvector of n*n matrix in java  Here...[][] {{4,3,1,2},{1,1,1,1},{1,2,1,1},{1,1,1,1} }; double t, c, s; int p, q, icount..., rowOfElMax, maxElRow); q = rowOfElMax[0]; p = colRowOfElMax
date convertion
date convertion  How to convert the string date format 23/11/2009 to original date format in asp.net
Mysql Date from Date
Mysql Date from Date       Mysql  Date from Date Time in Mysql return the Current  date. Understand with ExampleADS_TO_REPLACE_1 The Tutorial illustrate
Java Date
Java Date  Hi, What is the API for Date management in Java? How use the Java Date API for manipulating date object in Java? Provide some... of API for working with date and time objects in Java. You can also use third
Date Picker
Date Picker  "I want to set default calendar date when using datepicker. This date means auto-loaded date when the calendar appears. The default date is the current date. I want to change it. How could I do
date print
date print  how can i print the date in jsp page in the following formate month-date-year. (example. march 8 2012
date print
date print  how can i print the date in jsp page in the following formate month-date-year. (example. march 8 2012
Date & Time
Date & Time  How to insert System Date & Time in MS-ACCESS using Java
Date & Time
Date & Time  How to insert System Date & Time in MS-ACCESS using Java
PHP Date
PHP Date  Hi, How to use PHP Date functions in my PHP program? Thanks   Hi, PHP Date functions is very handy. It is used to progracess, format and create date objects in PHP. There are many ways to use PHP Date
date function
date function  Write a JavaScript program to read a date from user and perform the following, if entered value is date then perform the following 1. Display the day no from the date 2. Display the year from the date 3. Display

Ads