Forum     

Go Back   Digit Technology Discussion Forum > Software > Software Q&A
Register FAQ Calendar Mark Forums Read

Software Q&A Having trouble with software? Find solutions here


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 10-06-2007, 09:50 PM   #1 (permalink)
Right Off the Assembly Line
 
Shayon's Avatar
 
Join Date: Jun 2007
Location: Mumbai, India
Posts: 17
Question How to specify date format in visual basic 6?


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!!
Shayon is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 12-06-2007, 01:15 AM   #2 (permalink)
Rubik's Uncle!!
 
Charan's Avatar
 
Join Date: Sep 2004
Location: ಬೆಂಗಳೂರು (Bengaluru)
Posts: 3,791
Default Re: How to specify date format in visual basic 6?

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
__________________
i5 2400 | DH67BL | G.Skill Ripjaw 4 GB | FSP SAGA II 500W | CM 430 Black Elite | MSI R6850 Cyclone PE/OC | XBox 360 Controller | 21.5" Samsung Sync Master 2233 | 4 Mbps @75GB FUP :)
Battlefield 3 Multiplayer Discussion | Battlefield 3 Low Latency Servers List
Charan is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
visual basic database Sridhar_Rao Programming 4 04-03-2007 09:48 PM
Visual Basic help! romeo_8693 QnA (read only) 18 17-02-2007 07:55 PM
Visual Basic....! vineetrocks2005 QnA (read only) 2 20-06-2006 11:25 PM
can't install visual basic 6 gvrappu Software Q&A 5 07-12-2005 06:22 PM
Visual Basic 6.0 godsownman QnA (read only) 5 18-04-2005 06:27 AM

 
Latest Threads
- by chris
- by icebags
- by Tenida
- by Who

Advertisement




All times are GMT +5.5. The time now is 11:49 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2