DIGIT-ARC read-only archive · snapshot: July 23, 2026

How to specify date format in visual basic 6?

2 posts · originally from https://geek.digit.in/community/threads/how-to-specify-date-format-in-visual-basic-6.60081/

Shayon
Shayon Original post #1
Jun 10, 2007 at 9:50 PM
Well, I've been trying to compare dates using the CDate() function. For example, I wish to compare 5th of June, 2007 and 2nd of July, 2008. Now, everytime I try comparing these dates as :

Code:
 MsgBox CDate("05/06/2007") >= CDate("02/07/2007")
The answer I get is True because it treats them as 05062007 and 02072007 (at least, that's wot it seems) and ofcourse, 05062007 is larger.

I feel it'd help me if, right when a form loads, I could specify my default date format as yyyy/mm/dd. Could you please let me know how to do that effectively?

Or, it'd even help a lot if you could tell me how to compare dates, more efficiently!!
RCuber
RCuber #2
Jun 12, 2007 at 1:15 AM
try this
Code:
Dim i As Integer
i = DateDiff("d", "05/06/2007", "02/07/2007")
If i < 0 Then
MsgBox "FLASE"
Else
MsgBox "TRUE"
End If