473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

convert GregorianCalender to string

1
hoping someone can help, got a bit of homework I'm stuck on. It's as follows...

There is a standard class called DateFormat which (among other things) lets you convert dates to various different output formats. It has a subclass SimpleDateFormat which you may also use).

Use it to write a method called convert which returns a String in the form dd/mm/yy: when passed a GregorianCalendar with a specific date
public String convert (Calendar gc) {
...
}

For example, when myGC is a GregorianCalendar variable representing the 25th of December 2006,
String s = convert(myGC);
should set s to the string "12/25/06".

Enter your answer (just your convert method) below:


i have no idea when it comes to DateFormat/SimpleDateFormat...
Feb 27 '07 #1
2 3495
RedSon
5,000 Expert 4TB
hoping someone can help, got a bit of homework I'm stuck on. It's as follows...

There is a standard class called DateFormat which (among other things) lets you convert dates to various different output formats. It has a subclass SimpleDateFormat which you may also use).

Use it to write a method called convert which returns a String in the form dd/mm/yy: when passed a GregorianCalendar with a specific date
public String convert (Calendar gc) {
...
}

For example, when myGC is a GregorianCalendar variable representing the 25th of December 2006,
String s = convert(myGC);
should set s to the string "12/25/06".

Enter your answer (just your convert method) below:


i have no idea when it comes to DateFormat/SimpleDateFormat...
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidlines.

Then when you are ready post a new question in this thread.

MODERATOR
Feb 27 '07 #2
r035198x
13,262 8TB
hoping someone can help, got a bit of homework I'm stuck on. It's as follows...

There is a standard class called DateFormat which (among other things) lets you convert dates to various different output formats. It has a subclass SimpleDateFormat which you may also use).

Use it to write a method called convert which returns a String in the form dd/mm/yy: when passed a GregorianCalendar with a specific date
public String convert (Calendar gc) {
...
}

For example, when myGC is a GregorianCalendar variable representing the 25th of December 2006,
String s = convert(myGC);
should set s to the string "12/25/06".

Enter your answer (just your convert method) below:

i have no idea when it comes to DateFormat/SimpleDateFormat...
While you are at it you can go the java API and read the entry on SimpleDateFormat if you don't know how to use it.
Feb 28 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Joel Moore | last post by:
Maybe I'm just easily baffled after an all-nighter but I can't seem to figure out how to represent a BitArray as a hexadecimal string. For example: Dim outputBank As New BitArray(8) ...
4
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is...
4
by: aevans1108 | last post by:
expanding this message to microsoft.public.dotnet.xml Greetings Please direct me to the right group if this is an inappropriate place to post this question. Thanks. I want to format a...
3
by: Convert TextBox.Text to Int32 Problem | last post by:
Need a little help here. I saw some related posts, so here goes... I have some textboxes which are designed for the user to enter a integer value. In "old school C" we just used the atoi function...
7
by: patang | last post by:
I want to convert amount to words. Is there any funciton available? Example: $230.30 Two Hundred Thirty Dollars and 30/100
6
by: patang | last post by:
Could someone please tell me where am I supposed to put this code. Actually my project has two forms. I created a new module and have put the following code sent by someone. All the function...
4
by: tshad | last post by:
I am trying to convert a string character to an int where the string is all numbers. I tried: int test; string stemp = "5"; test = Convert.ToInt32(stemp); But test is equal to 53.
9
by: Marco Nef | last post by:
Hi there I'm looking for a template class that converts the template argument to a string, so something like the following should work: Convert<float>::Get() == "float"; Convert<3>::Get() ==...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.