This week's book giveaway is in the
We're giving away four copies of
Arduino in Action
and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Arduino in Action
this week in the
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
Java in General
Joined: May 31, 2004
Oct 25, 2004 19:54:00
I have a problem getting the day from a
. I hope somebody can help me.
here is my sample code:
String currDate = "";
String month = "";
String year = "";
currDate = year+"-"+month+"-"+i;
I want to display only the date without the month and the year and get the day of that particular date. how to solve this problem? can anybody help me? thanks.
Author and ninkuma
Joined: Jan 10, 2002
Oct 25, 2004 20:17:00
Not much to do with
, so I'm moving this off to the Java in General (intermediate) forum.
Books by Bear
Joined: Sep 14, 2001
Oct 25, 2004 20:19:00
I think you can use Gregorian Calendar..
Calendar calendar1 = new GregorianCalendar(); //It give us current time Calendar calendar2 = new GregorianCalendar(year, month, date); // It give us Gregorian calendar with specified date int date = calendar1.get(Calendar.DAY_OF_MONTH);//Returns date int dayOfWeek = calendar1.get(Calendar.DAY_OF_WEEK); //Returns day
You can refer to
and Calendar API to get specific purpose you need...
Hope this helps...
Correct me if I am wrong
Joined: Dec 06, 2001
Oct 26, 2004 18:20:00
class provides a slick way to do this with only a few lines of code:
DateFormatter df = new DateFormatter("yyyymmdd hhmm"); Date date = new Date(); String dateString = df.valueToString(date);
(Disclaimer: This code does not come with any warranty, explicit or implied. It has not been compiled or tested, so use at your own risk.)
Consult the API docs for further details.
Java API Documentation
The Java Tutorial
I agree. Here's the link:
- it saves me about five hours per week
subject: Date problem
Retrive Month and Year
Crazy date program
A question on java.util.Date
request.getParameter retuning null
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013