format date in mysql not working
hi! :wave:
I'm trying to execute this line but its not working.
Code:
txtdate=format(now,"yyyy/mm/dd")
the result should be 2010/05/19 instead its 05/19/2010. I'm using vb6 and mysql.I'm trying to compare the date in my database and the current date.and since the date format of mysql is yyyy/mm/dd i need to format the current date for them to meet.is there something missing in my code?
Thanks!
Re: format date in mysql not working
I don't see any problem with the code:
Code:
Private Sub Command1_Click()
Me.Caption = Format(Now, "yyyy/mm/dd") '~~~ Gives 2010/05/19
End Sub
Did you tried using Date instead of Now ?
....:wave:
Re: format date in mysql not working
Quote:
Originally Posted by
enigmagirl122
is there something missing in my code?
Yes, at least in terms of what you posted.
You have not given any indication of what txtdate is, or shown us anything at all to do with databases.
1 Attachment(s)
Re: format date in mysql not working
Quote:
Originally Posted by
enigmagirl122
I'm trying to execute this line but its not working.
Code:
txtdate=format(now,"yyyy/mm/dd")
the result should be 2010/05/19 instead its 05/19/2010.
Enigma
Hmmm.. I just tried that, and I get "2010/05/19"
Unfortunately, I don't understand why you would not get the same result.
EDIT:
In case the image isn't self-evident, I put a breakpoint in my
sub, and hovered the mouse over "txtdate" (the mouse pointer
does not appear in the image) ...
... hence the tooltip is returning the value of "txtdate"
Spoo
.
Re: format date in mysql not working
Quote:
is there something missing in my code?
Yes... the REAL code... not some sample contrived code that works... your example has nothing to do with mySQL... so clearly there are other factors involved. So maybe if you showed us the real code that you are using you'll get more useful answers besides "It works for me."
-tg