Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro Java
| Search | Today's Posts | Mark Forums Read
Pro Java Expert level Java questions not about a specific book. Please indicate your version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Java section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 13th, 2008, 03:49 AM
Authorized User
 
Join Date: Sep 2008
Location: , , Singapore.
Posts: 87
Thanks: 1
Thanked 0 Times in 0 Posts
Default year to date conversion

hi ,

i have a string sYear = 2008;
i need search from the database the results which are in the year 2008.

so how can i convert 2008 to this format

    sDateFrom = "2008-01-01";
    sDateTo = "2008-12-31";

thanks in advance...
raj

 
Old November 11th, 2008, 01:41 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

If you need just a string you can append needed values. If you need a date object then you can use java.util.Calendar class and its set..() methods. Check java API for more information about Calendar class.

- Rakesh




Similar Threads
Thread Thread Starter Forum Replies Last Post
Using month & year variable to get date in range rsearing ASP.NET 2.0 Professional 2 July 5th, 2008 08:30 AM
How to pull Month & Year from Date(dd/mm/yyyy) istcomnet Classic ASP Basics 2 April 22nd, 2008 06:22 PM
Month and Year to Date on a Report Mitch Access 2 February 20th, 2007 10:23 AM
Date= starting of the current fiscal year rmanu7382 Reporting Services 0 April 3rd, 2006 12:42 AM
Date conversion lily611 General .NET 6 December 6th, 2004 12:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.