|
-
July 22nd, 2010, 07:20 AM
#1
datetime - date only
Hi
I have a mod.Start datetime value that I want to be displayed like so... Thursday, 15 July 2010
I am using the following code.....
Code:
string modStart;
modStart = (mod.Start.ToString("dddd, dd MMMM yyyy"));
if (mod != null)
{
return mod.Name + " (" + mod.Reference + ") - " + modStart;
}
return "";
however i get the following error.....
Compiler Error Message: CS1501: No overload for method 'ToString' takes '1' arguments
What is wrong?
I can get the following to work but it returns the date like so...15/07/2010
ideally i want the date in the other format, above
Code:
string modStart;
modStart = (mod.Start.ToString());
modStart = modStart.Substring(0, 10);
Please advise, thank you in advance :-)
Last edited by HanneSThEGreaT; July 22nd, 2010 at 07:26 AM.
Reason: Added [CODE] tags.
-
July 22nd, 2010, 07:27 AM
#2
Re: datetime - date only
Please make use of [CODE] tags when posting code.
-
July 22nd, 2010, 08:35 AM
#3
Re: datetime - date only
And your "Start" is a datetime and not just a string representation of a datetime?
-
July 22nd, 2010, 08:40 AM
#4
Re: datetime - date only
Hi Alsvha
Yes, Start is a datetime value, for example 31/03/2011 00:00:00
-
July 22nd, 2010, 12:45 PM
#5
Re: datetime - date only
Well, the error seems pretty obvious
"CS1501: No overload for method 'ToString' takes '1' arguments"
-
July 23rd, 2010, 03:26 AM
#6
Re: datetime - date only
thanks BigEd781! if only i was as smart as you!.... why the hell would I ask for help if I knew what the error meant, I'm new to c# and don't know that's why I asking, just unfortunate that ****** like you are around! stop wasting my time and yours and show off somewhere else....I suspect you're only Big in name as well!
Last edited by HanneSThEGreaT; July 23rd, 2010 at 06:24 AM.
Reason: Removed Profanity.
-
July 23rd, 2010, 04:20 AM
#7
Re: datetime - date only
Yo, easy with the bad blood!
What Alsvha asked you is what is the type (class) of "Start", not what it represents.
If it's the DateTime class, there should be an overload of the string method that would enable you to do what you wanted to do.
As BigEd781 said, the error is pretty obvious - whatever the class of "Start" is, it doesn't contain such an overload. This indicates that it's not DateTime. Maybe you just stored the value in a string?
Find in the definition of "Start" in your code, and find out the type.
-
July 23rd, 2010, 06:23 AM
#8
Re: datetime - date only
 Originally Posted by katy.morgan
thanks BigEd781! if only i was as smart as you!.... why the hell would I ask for help if I knew what the error meant, I'm new to c# and don't know that's why I asking, just unfortunate that ******* like you are around! stop wasting my time and yours and show off somewhere else....I suspect you're only Big in name as well!
OK. That's quite inapropriate, and uncalled for. Calling people names will not get you anywhere here. This is the AUP
I am closing this thread now, before it gets out of hand.
Consider this a warning
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|