Total members 11894 |It is currently Thu Nov 21, 2024 11:47 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Hello,
I m having a code which gives date of a particular event like :

Code:
String date=date1.substring(3,5)+"/"+date1.substring(0,2)+"/"+date1.substring(6,10); 


I want the start date and end date of the month of which the above date belongs to..


Kindly help.




Author:

Code:

   Calendar calendar 
Calendar.getInstance();
  
int yearpart 2010;
  
int monthPart 11;
  
int dateDay 1;
  
calendar.set(yearpartmonthPartdateDay);
  
int numOfDaysInMonth calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
  
System.out.println("Number of Days: " numOfDaysInMonth);
  
System.out.println("First Day of month: " calendar.getTime());
  
calendar.add(Calendar.DAY_OF_MONTHnumOfDaysInMonth-1);


  
System.out.println("Last Day of month: " calendar.getTime());
 


_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : Want start and end date of a month from current date
 Printing today+ current date with different format     -  
 Formatting a Date with date()     -  
 get next date by next day     -  
 String to sql.Date     -  
 date validation in asp     -  
 How To Increment Date In JSP?     -  
 Date in Java     -  
 date formatting in Java     -  
 Convert String to Date     -  
 Google indexing DATE     -  



Topic Tags

Java Time
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com