Converting text to date
-
Can someone help me out with this. I want to have the user enter a date in the textbox and then on LEAVE validate and convert it to gregorian format. Example: Enter 01011995 in the text box and return 01/01/1995 OR 1195 or 111995 The code below worked until last week when I rebuilt my system; now it no longer works and I can't seem to find a way of making it. dim mydate as string mydate = Format(Me.editHireDate.Text.ToString, "Short Date") Arnie
-
Can someone help me out with this. I want to have the user enter a date in the textbox and then on LEAVE validate and convert it to gregorian format. Example: Enter 01011995 in the text box and return 01/01/1995 OR 1195 or 111995 The code below worked until last week when I rebuilt my system; now it no longer works and I can't seem to find a way of making it. dim mydate as string mydate = Format(Me.editHireDate.Text.ToString, "Short Date") Arnie
-
Can someone help me out with this. I want to have the user enter a date in the textbox and then on LEAVE validate and convert it to gregorian format. Example: Enter 01011995 in the text box and return 01/01/1995 OR 1195 or 111995 The code below worked until last week when I rebuilt my system; now it no longer works and I can't seem to find a way of making it. dim mydate as string mydate = Format(Me.editHireDate.Text.ToString, "Short Date") Arnie
Like cnurse said, but why does everyone execute
.ToString()
on something that's ALREADY A STRING! A.Text
property always returns aString
. Can someone explain to me, the purpose of converting aString
to aString
? Sorry, one of my pet peeves. Oh! And usingMe
to death pisses me off to! It's completely unnecessary...mydate = Format(cDate(editHireDate.Text), "Short Date")
RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Like cnurse said, but why does everyone execute
.ToString()
on something that's ALREADY A STRING! A.Text
property always returns aString
. Can someone explain to me, the purpose of converting aString
to aString
? Sorry, one of my pet peeves. Oh! And usingMe
to death pisses me off to! It's completely unnecessary...mydate = Format(cDate(editHireDate.Text), "Short Date")
RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Dave, LMAO! I have the same pet hates, but sometimes until somebody says "you don't need to" people's habits remain the same. I remember prefixing ME. in vb4 actually slowed it down coz the stupid environment even resolved the referemce too! so funny. Another one of my pet hates is people not coding with Option Strict. There are lots of others and so little time hahahaha Have a good XMAS mate. Nursey
-
Like cnurse said, but why does everyone execute
.ToString()
on something that's ALREADY A STRING! A.Text
property always returns aString
. Can someone explain to me, the purpose of converting aString
to aString
? Sorry, one of my pet peeves. Oh! And usingMe
to death pisses me off to! It's completely unnecessary...mydate = Format(cDate(editHireDate.Text), "Short Date")
RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Dave Kreskowiak wrote: Oh! And using Me to death pisses me off to! It's completely unnecessary... LMAO...But Intellisense makes it so useful to help remember all those names that I forget!
:-D What? You can't remember your own object names!? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Dave, LMAO! I have the same pet hates, but sometimes until somebody says "you don't need to" people's habits remain the same. I remember prefixing ME. in vb4 actually slowed it down coz the stupid environment even resolved the referemce too! so funny. Another one of my pet hates is people not coding with Option Strict. There are lots of others and so little time hahahaha Have a good XMAS mate. Nursey
Well, Option Strict I don't have a problem with, because sometimes it goes get in the way. For example, you can't use any late binding with it turned on. It's very helpful to turn that off when you using WMI. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Arnie, try this simple change... mydate = Format(cDate(Me.editHireDate.Text.ToString), "Short Date") Nursey
cnurse wrote: Arnie, try this simple change... mydate = Format(cDate(Me.editHireDate.Text.ToString), "Short Date") Nursey I appreciate the input. I used your idea/code (even took off the "ToString") and still *&*^*& What I'm getting in return is what has caused me to look at options, settings and so on... "Cast from string "01151995" to type 'Date' is not valid. Arnie