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?
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 ?
....
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India
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"
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."