check date

2 views
Skip to first unread message

tulika agrawal

unread,
Oct 3, 2005, 1:56:36 AM10/3/05
to Techdot...@googlegroups.com, bdotnet
hi all
i m using vb6.0
i asked the date information from user in dd/mm/yyyy format.
how can i check that the date entered by user is in correct date format.
please provide me some help.
in vb isdate() function is used to check the date in "mm/dd/yyyy" format. but i want to check in dd/mm/yyyy format
 

BabuLives

unread,
Oct 3, 2005, 2:08:58 AM10/3/05
to .NetIndia

BabuLives

unread,
Oct 3, 2005, 2:08:57 AM10/3/05
to .NetIndia

tulika agrawal

unread,
Oct 3, 2005, 2:32:09 AM10/3/05
to Techdot...@googlegroups.com
thanks
but i need in visual basic 6.0
in vb we can't use  regular expression.
please provide me in visual basic

 

Aqil Shah

unread,
Oct 3, 2005, 4:23:44 AM10/3/05
to Techdot...@googlegroups.com
Hi Tulika,
     use Format function for it.
if u r taking dtpicker then
 
    Format(dtpicker1.value, "dd/MM/yyyy")
 
 
'to check
 
if dtpicker1.value <> format(dtpicker1.value, "dd/MM/yyyy") then
         'code
end if
 
or if u r entering from text box then replace dtpicker.value by text1.text etc.
   Bye
   Aqil Shah

 

tulika agrawal

unread,
Oct 3, 2005, 4:32:21 AM10/3/05
to Techdot...@googlegroups.com
hi
thanks
but i m not using the date picker control.
i retrive the value from textbox.

 

BabuLives

unread,
Oct 3, 2005, 4:41:58 AM10/3/05
to .NetIndia
Set the date format in control panel,under regional setting..

tulika agrawal

unread,
Oct 3, 2005, 4:57:54 AM10/3/05
to Techdot...@googlegroups.com
i can't use this . because other software were effectect by changing the regional setting, is there any othe solution to check date?


 
On 10/3/05, BabuLives <sathees...@gmail.com> wrote:

Aqil Shah

unread,
Oct 3, 2005, 5:02:33 AM10/3/05
to Techdot...@googlegroups.com
just replace the dtpicker1.value with text1.text.
 

 
On 10/3/05, BabuLives <sathees...@gmail.com> wrote:

Aqil Shah

unread,
Oct 3, 2005, 5:14:52 AM10/3/05
to Techdot...@googlegroups.com
why dont you use format function??
 
 
 
if nameoftextbox.text <> Format(nameoftextbox.text,"dd/MM/yyyy") then
    ' Doesnt match
else
    'proceed
end if
 
 
it is very simple.
 
 

tulika agrawal

unread,
Oct 3, 2005, 5:41:41 AM10/3/05
to Techdot...@googlegroups.com
thanks for all reply
but my problem is stlli remain same

 
On 10/3/05, Aqil Shah <aqil...@gmail.com> wrote:

Aqil Shah

unread,
Oct 3, 2005, 5:52:40 AM10/3/05
to Techdot...@googlegroups.com
mail your code, where is the actual problem ??

BabuLives

unread,
Oct 3, 2005, 5:54:13 AM10/3/05
to .NetIndia
hai...
use Format function as said by aquil...

or else try this link it may help u out...

http://www.visualbasicforum.com/showthread.php?t=12364

http://www.officecomputertraining.com/vbtutorial/tutpages/page32.asp


Regards,
Satheesh

tulika agrawal

unread,
Oct 3, 2005, 6:06:31 AM10/3/05
to Techdot...@googlegroups.com
hi
read the following code
Text2.Text = Format(Text1.Text, "mm/dd/yyyy")
if user enter "4454545" in textbox1 than it gives the error overflow error
how can i remove this error.
 
On 10/3/05, BabuLives <sathees...@gmail.com> wrote:

Aqil Shah

unread,
Oct 3, 2005, 6:10:21 AM10/3/05
to Techdot...@googlegroups.com
if  isdate(text1.text) then
         Text2.Text = Format(Text1.Text, "mm/dd/yyyy")
else
     msgbox "Please enter valid date!", vbokonly
end if
 

tulika agrawal

unread,
Oct 3, 2005, 6:24:47 AM10/3/05
to Techdot...@googlegroups.com
great, it is working fine, same the way i m needed
earlier,i worked with isdate() function, i thought that it checks the date in only in "mm/dd/yyyy" format.
but i m surprised to see that its also chech the date in "dd/mm/yyyy" also.
thanks to u.
tulika


 
On 10/3/05, Aqil Shah <aqil...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages