|
-
Jul 31st, 2004, 05:14 PM
#1
Thread Starter
Member
Parsing Date
Hey all,
I need to create a date format that is 8/15/2004 but without the "/"'s. This is the code i'm using to get the date as it is now.
VB Code:
theTime.Now.ToShortDateString()
That gives me 7/31/2004, but how do I take out the /'s. Anyone know how to do that.
Cran56
-
Jul 31st, 2004, 05:53 PM
#2
PowerPoster
Can't you do something like this:
Dim myString As String
myString = DateTime.Now.ToShortDateString()
myString = myString.Replace("/", "")
I haven't loaded up VS or anything to verify it, but it might get you close.
-
Aug 1st, 2004, 12:52 AM
#3
Hyperactive Member
or you might try
dim MyDate as string = format(Now,"MMddyyyy")
-
Aug 1st, 2004, 02:18 AM
#4
PowerPoster
Duh...lol, thanks for pointing that out.
You can get rid of the format function call and just use the overloaded .ToString() method:
mystring = DateTime.ToString("MMddyyyy")
-
Aug 1st, 2004, 01:56 PM
#5
Hyperactive Member
LOL - there is always a better way!
-
Aug 1st, 2004, 06:50 PM
#6
PowerPoster
Originally posted by hellswraith
Duh...lol, thanks for pointing that out.
You can get rid of the format function call and just use the overloaded .ToString() method:
mystring = DateTime.ToString("MMddyyyy")
Does not work for me because
"Reference to a non shared member requires an object reference"
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Aug 2nd, 2004, 05:01 AM
#7
Fanatic Member
hello taxes. i guess, just a small error. as hellswraith has no vs to play with. it's
VB Code:
dim s as string=datetime.now.tostring("MMddyyyy")
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
|