Question: Operations with Calendar



Share on Google+Share on Google+

Operations with Calendar
2 Answer(s)      4 years and 8 months ago
Posted in : Java Beginners

I have the following as my known parameter Effective Date : 21-08-2012 Cut off day : Thursday I want my first cycle calculation done from 21-08-2012 till wednesday(22-08-2012) and from thursday my second cycle of calcultion starts

My question is how to find the date of Thursday

This cycle repeats based on every cut off day

View Answers

August 21, 2012 at 6:06 PM

Here is an example that displays the date of all the thursdays of the given year.

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

public class GetDateFromDay{

   public String getDateOfWeekDay(int weekId, int year, int weekDay){
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.YEAR, year);
        cal.set(Calendar.WEEK_OF_YEAR, weekId);
        cal.set(Calendar.DAY_OF_WEEK, weekDay);

        SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
        return  sdf.format(cal.getTime());    
        public static void main(String args[]){
        GetDateFromDay dt = new GetDateFromDay();
        for (int weekCount = 1; weekCount <= 53; weekCount++) {

August 23, 2012 at 1:55 PM

But I have a problem here

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


Related Tutorials/Questions & Answers:
Operations with Calendar
Operations with Calendar  I have the following as my known parameter Effective Date : 21-08-2012 Cut off day : Thursday I want my first cycle... getDateOfWeekDay(int weekId, int year, int weekDay){ Calendar cal
calendar  sir, how to fix calendar in javascript..pls provide the complete source code..   Please visit the following link:
calendar  I got one requirement like this i have to display a calendar with only current month and whenever user selects the date, that date needs to be display in a text field
Operations on string
Operations on string  Apply undo,redo operations on String pool in java
Java Calendar Example
the current date of the calendar and few other operations. For this, we have...() { System.out.println("Performing operations on calendar dates."); // Get... at 06:37:07 PM GMT+05:30 Performing operations on calendar dates. Before
calendar - Date Calendar
Creating a Date calendar in Java  I am looking for a code for Creating a Date calendar in Java
calendar - Struts
Java calendar example  Please explain the Java calendar example
calendar js
calendar js  there are two calendar on form and i want that once date chosen from first calendar , the second calendar should be disabled till that date. for eg once i have chosen date 21-03-2012 from first calendar
class Calendar - Java Beginners
Calendar,include the following operations: a.Determine the first day of the month for which the calendar will be printed.Call this operation firstDayOfMonth... print a calendar for any month starting Junuary 1,1500.Note that the day
Java Calendar !?
Java Calendar !?  I need to create a Java Calendar in an Applet. The calendar displays months (jan - dec) in a 3x4 grid ... jan feb march \n april.... so if a user picks the year 2000 show the calendar from that year. So how do i
crud operations with foreign key constraint.
crud operations with foreign key constraint.  I neeed to know how to perform crud operations in mysql with foreign key constraint using mvc architecture i.e using servlet jsp and bean. please provide all the code so that i can
CRUD operations in spring mvc 2.5
CRUD operations in spring mvc 2.5  Hi, I want to do CRUD operations on jquery datatable such as edit delete select and add row. I am using spring mvc 2.5. How can I do this. Thanks in advance
Java Calendar issue - Date Calendar
Java Calendar issue  Hi I have having weird situation with java Calendar, its driving me crazy. My requirenment is that i got a xml schema element that accepts only Calendar Type Say element 2011-09-25T13:00:00 Say
Calendar Issues
Calendar Issues  I am trying to get this calendar to to display to date selected on a new page. Right now it opens a new page but does not diplay the date from the calendar on the previos page. Here is my code <!DOCTYPE
javascript calendar popup code
javascript calendar popup code  javascript calendar popup code
Calendar Operation
Calendar Operation  I have a date - example - 22-09-2012(start date) I have to find my end date based on the current quarter My input are month of the quarter which is a list box with values(1,2,3) , Day of the month in list
Calendar       In this section we are displaying the days of  a specific month and the calendar format of the days for this month. We are also checking whether the year
(Displaying a calendar in GUI
(Displaying a calendar in GUI  (Displaying a calendar) Write a program that displays the calendar for the current month, as Use labels, and set texts on the labels to display the calendar."The Calendar and GregorianCalendar
event calendar sample
event calendar sample  creating a event calendar for my small app in PHP.. can any one explain about it's design with example php event calendar script
j2me code - Date Calendar
j2me code  how to write a calendar program using alert
calendar in php code - PHP
calendar in php code   Any Idea to create a calendar for school in PHP? I need a simple nd handy code
Hibernate Performing the usual DB operations
HIBERNATE-BASICS Hibernate Performing the usual DB operations... the usual DB operations. Hybernate2 can be downloaded from http... program with 4 buttons for add, modify, delete and find operations. We can call
Gregorian calendar class
Gregorian calendar class  Hai... What is the purpose of gregorian calendar class?   Java provides the standard calendar by providing the class GregorianCalendar in java.util package. The Gregorian calendar is used
Java Coding - Date Calendar
Java Coding  Write a program that prompts the user to enter the year and first day of the year and displays the calendar for the year on the console... 1,2005, your program should display the calendar for each month in the year
Java JMenuItem to perform file operations
Java JMenuItem to perform file operations In this tutorial, you will learn how to use JMenuItem class to perform file operations. Java Swing introduced... example in java swing through which you can perform open and save operations
Javascript Create Calendar
Javascript Create Calendar  how to create calender application   Please visit the following link: Javascript create Calendar
codes for displaying in calendar
codes for displaying in calendar  can i get jsp codes for displaying comments, when the pointer is placed over the particular date in calendar
php date input calendar
php date input calendar  I'm having an issue while writing the date input calendar function in PHP.. any help? Thanks
Java Spring Hibernate Struts Training What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java Java Example Codes and Tutorials in 2017 How do I read a large file quickly in Java? Is learning Java worthwhile? How to create first Java Program? Retrieve database from the table dynamically in jsp from oracle using servlet What does core Java include? java What are some way to learn Java quickly?


Advertisement null