Finding A Date

Ads
 

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()));
    }
}

Ads









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
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
Advertisements
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
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
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
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
user defined date class
user defined date class  Develop a user defined date class with public.Fill the members using existing class method.implement the methods for finding current date(),days between method,advanced days and after days
user defined date class
user defined date class  Develop a user defined date class with public.Fill the members using existing class method.implement the methods for finding current date(),days between method,advanced days and after days
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
Mysql Date Today
date in Mysql. Query for finding the current date:- mysql>... Mysql Date Today       Mysql Date Today show you Query to retrieve the current today date
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
Hibernate Criteria Max Date Example
for finding the maximum date using Hibernate Criteria? Thanks   If you want to use Hibernate Criteria for finding max Date in Java program then check... for finding max Date in Java program then check the following links: Example
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
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
date convertion
date convertion  How to convert the string date format 23/11/2009 to original date format in asp.net
how to write a function to print for finding the longest palindrome in the given string
how to write a function to print for finding the longest palindrome in the given string  how to write a function to print for finding the longest palindrome in the given string
Mysql Date from Date
Mysql Date from Date       Mysql  Date from Date Time in Mysql return the Current  date. Understand with Example The Tutorial illustrate an example from 'DateTime
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

Ads