Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


heybuddy
Finding A Date
1 Answer(s)      2 years and 4 months ago
Posted in : Java Beginners


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


Advertisement
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
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 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 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
Finding duplicates using array in for loop
Finding duplicates using array in for loop  how to find the duplicates in array using for loop
date
date   how to insert date in database? i need coding
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
date
date  i want difference between the date entered in a jtextfield 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  can u tell me how to calculate difference between a user provided date 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 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
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 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
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
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
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
Advertisements
 

 

 

DMCA.com