Results 1 to 4 of 4
  1. #1
    javastuden's Avatar
    javastuden is offline Senior Member
    Join Date
    Nov 2009
    Posts
    160
    Rep Power
    5

    Default want the first date and last date of each month

    HI all,
    how can i get the dates between to month limts
    eg:march(2)-2009 to feb(1)2010

    condition that
    i want the first date and last date of each month
    means
    2009-03-01 to 2009-03-31
    2009-04-01 to 200-04-30
    .........................
    .......................
    ............................
    2010-02-01 to 2010-02-28


    please help me

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Do read your database reference manual like I've already said before.
    There is a between clause that is well documented.
    You don't lose a dollar everytime you read a sentence from a book.

  3. #3
    javastuden's Avatar
    javastuden is offline Senior Member
    Join Date
    Nov 2009
    Posts
    160
    Rep Power
    5

    Default answer to question

    thanks for reply

    and what is your reply and what is my query

    i requested that any one knows the as per the example the date of a month with beginning and ending
    then the answer is or has to be like this
    for ( Calendar c = cal1; c.compareTo ( cal2 )<= 0; c.add ( Calendar.MONTH, 1 ) )
    {


    c.set(Calendar.DAY_OF_MONTH, c.getActualMinimum(Calendar.DAY_OF_MONTH));
    System.out.println(dateFormat.format(c.getTime())) ;
    c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
    System.out.println(dateFormat.format(c.getTime())) ;

    }

    and not to look the manul of DB if thats the matter then why i joined this forum

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    You didn't reply to your ealier thread so I assumed you dumped it after hearing the words read like everyone else does.

Similar Threads

  1. julian date to full date format
    By judy318 in forum New To Java
    Replies: 7
    Last Post: 11-02-2009, 12:17 PM
  2. Compare date input to database with current date
    By hungleon88 in forum Advanced Java
    Replies: 2
    Last Post: 11-25-2008, 08:10 AM
  3. Creating a Gregorian Calendar using a Date object gives date - 1
    By prachi_goliwadekar in forum New To Java
    Replies: 1
    Last Post: 05-08-2008, 08:32 PM
  4. Difference between current date and anothe date
    By vijay balusamy in forum New To Java
    Replies: 1
    Last Post: 04-16-2008, 04:15 PM
  5. date one month back
    By senzacionale in forum New To Java
    Replies: 1
    Last Post: 12-24-2007, 09:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •