This is the code that compares the two dates
If (CalendarDate1 >= CalendarDate2) Then
MsgBox "Please enter the correct date range", vbOKOnly + vbExclamation,
"SASMonitor"
Exit Sub
End If
The below code is where i get the date from the user.i have two calendar
components in my form.that's why two calendar
Private Sub Calendar1_Click()
CalendarDate1 = Trim(Format(Calendar1.Value, "dd-mm-yy"))
Command1.Enabled = False
MsgBox CalendarDate1
End Sub
Private Sub Calendar2_Click()
CalendarDate2 = Trim(Format(Calendar2.Value, "dd-mm-yy"))
Command1.Enabled = False
Command3.SetFocus
MsgBox CalendarDate2
End Sub
'when i do this i am not able to get the correct comparison.the case is when
i select 10th may 2004 from the first calendar and 1st june 2004 from the
second calendar,it says that 10th may 2004 is greater.pls help me.
Thanks in advance. 14 2771
Kurien Baker Fenn <Ku*************@discussions.microsoft.com> wrote: This is the code that compares the two dates
If (CalendarDate1 >= CalendarDate2) Then MsgBox "Please enter the correct date range", vbOKOnly + vbExclamation, "SASMonitor" Exit Sub End If
The below code is where i get the date from the user.i have two calendar components in my form.that's why two calendar
Private Sub Calendar1_Click() CalendarDate1 = Trim(Format(Calendar1.Value, "dd-mm-yy")) Command1.Enabled = False MsgBox CalendarDate1 End Sub
Private Sub Calendar2_Click() CalendarDate2 = Trim(Format(Calendar2.Value, "dd-mm-yy")) Command1.Enabled = False Command3.SetFocus MsgBox CalendarDate2 End Sub
'when i do this i am not able to get the correct comparison.the case is when i select 10th may 2004 from the first calendar and 1st june 2004 from the second calendar,it says that 10th may 2004 is greater.pls help me.
What are CalendarDate1 and CalendarDate2 declared as? You're using them
as if they're dates at the top, but as strings lower down. You should
get them as DateTimes before doing comparisons.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Kurien Baker Fenn <Ku*************@discussions.microsoft.com> wrote: This is the code that compares the two dates
If (CalendarDate1 >= CalendarDate2) Then MsgBox "Please enter the correct date range", vbOKOnly + vbExclamation, "SASMonitor" Exit Sub End If
The below code is where i get the date from the user.i have two calendar components in my form.that's why two calendar
Private Sub Calendar1_Click() CalendarDate1 = Trim(Format(Calendar1.Value, "dd-mm-yy")) Command1.Enabled = False MsgBox CalendarDate1 End Sub
Private Sub Calendar2_Click() CalendarDate2 = Trim(Format(Calendar2.Value, "dd-mm-yy")) Command1.Enabled = False Command3.SetFocus MsgBox CalendarDate2 End Sub
'when i do this i am not able to get the correct comparison.the case is when i select 10th may 2004 from the first calendar and 1st june 2004 from the second calendar,it says that 10th may 2004 is greater.pls help me.
What are CalendarDate1 and CalendarDate2 declared as? You're using them
as if they're dates at the top, but as strings lower down. You should
get them as DateTimes before doing comparisons.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
"Jon Skeet [C# MVP]" wrote: Kurien Baker Fenn <Ku*************@discussions.microsoft.com> wrote: This is the code that compares the two dates
If (CalendarDate1 >= CalendarDate2) Then MsgBox "Please enter the correct date range", vbOKOnly + vbExclamation, "SASMonitor" Exit Sub End If
The below code is where i get the date from the user.i have two calendar components in my form.that's why two calendar
Private Sub Calendar1_Click() CalendarDate1 = Trim(Format(Calendar1.Value, "dd-mm-yy")) Command1.Enabled = False MsgBox CalendarDate1 End Sub
Private Sub Calendar2_Click() CalendarDate2 = Trim(Format(Calendar2.Value, "dd-mm-yy")) Command1.Enabled = False Command3.SetFocus MsgBox CalendarDate2 End Sub
'when i do this i am not able to get the correct comparison.the case is when i select 10th may 2004 from the first calendar and 1st june 2004 from the second calendar,it says that 10th may 2004 is greater.pls help me.
What are CalendarDate1 and CalendarDate2 declared as? You're using them as if they're dates at the top, but as strings lower down. You should get them as DateTimes before doing comparisons.
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
i declared Calendardate1 and calendardate2 as dim.so what should i do to
compare.Please help
Thanks in Advance
Kurien Baker Fenn <Ku*************@discussions.microsoft.com> wrote: i declared Calendardate1 and calendardate2 as dim.so what should i do to compare.Please help
What do you mean "as dim"?
Could you post a short but complete program which demonstrates the
problem?
See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
Do you have option strict on, by the way?
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
"Jon Skeet [C# MVP]" wrote: Kurien Baker Fenn <Ku*************@discussions.microsoft.com> wrote: This is the code that compares the two dates
If (CalendarDate1 >= CalendarDate2) Then MsgBox "Please enter the correct date range", vbOKOnly + vbExclamation, "SASMonitor" Exit Sub End If
The below code is where i get the date from the user.i have two calendar components in my form.that's why two calendar
Private Sub Calendar1_Click() CalendarDate1 = Trim(Format(Calendar1.Value, "dd-mm-yy")) Command1.Enabled = False MsgBox CalendarDate1 End Sub
Private Sub Calendar2_Click() CalendarDate2 = Trim(Format(Calendar2.Value, "dd-mm-yy")) Command1.Enabled = False Command3.SetFocus MsgBox CalendarDate2 End Sub
'when i do this i am not able to get the correct comparison.the case is when i select 10th may 2004 from the first calendar and 1st june 2004 from the second calendar,it says that 10th may 2004 is greater.pls help me.
What are CalendarDate1 and CalendarDate2 declared as? You're using them as if they're dates at the top, but as strings lower down. You should get them as DateTimes before doing comparisons.
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
i declared Calendardate1 and calendardate2 as dim.so what should i do to
compare.Please help
Thanks in Advance
Kurien Baker Fenn <Ku*************@discussions.microsoft.com> wrote: i declared Calendardate1 and calendardate2 as dim.so what should i do to compare.Please help
What do you mean "as dim"?
Could you post a short but complete program which demonstrates the
problem?
See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
Do you have option strict on, by the way?
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
"Jon Skeet [C# MVP]" wrote: Kurien Baker Fenn <Ku*************@discussions.microsoft.com> wrote: i declared Calendardate1 and calendardate2 as dim.so what should i do to compare.Please help
What do you mean "as dim"?
Could you post a short but complete program which demonstrates the problem?
See http://www.pobox.com/~skeet/csharp/complete.html for details of what I mean by that.
Do you have option strict on, by the way?
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
My platform is visual basics and i have declared it as dim.
"Jon Skeet [C# MVP]" wrote: Kurien Baker Fenn <Ku*************@discussions.microsoft.com> wrote: i declared Calendardate1 and calendardate2 as dim.so what should i do to compare.Please help
What do you mean "as dim"?
Could you post a short but complete program which demonstrates the problem?
See http://www.pobox.com/~skeet/csharp/complete.html for details of what I mean by that.
Do you have option strict on, by the way?
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
My platform is visual basics and i have declared it as dim.
Kurien Baker Fenn <Ku*************@discussions.microsoft.com> wrote: My platform is visual basics and i have declared it as dim.
No, dim is what you use *to* declare it - have you not specified what
actual type it should be? eg
Dim CalendarDate1 as DateTime
If you don't have option strict on, I strongly recommend that you put
it on.
Again, could you post a short but complete program which demonstrates
the problem?
See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Kurien Baker Fenn <Ku*************@discussions.microsoft.com> wrote: My platform is visual basics and i have declared it as dim.
No, dim is what you use *to* declare it - have you not specified what
actual type it should be? eg
Dim CalendarDate1 as DateTime
If you don't have option strict on, I strongly recommend that you put
it on.
Again, could you post a short but complete program which demonstrates
the problem?
See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Kurien,
It is funny in the newsgroup microsoft.public.dotnet.languages.vb there was
someone who had a kind same problem, it was seen directy in the code. (That
newsgroup is special for VBNet questions)
(I assume that Calendar1 is a datetimepicker because that has a value
property) Private Sub Calendar1_Click() CalendarDate1 = Trim(Format(Calendar1.Value, "dd-mm-yy")) Command1.Enabled = False MsgBox CalendarDate1 End Sub
That mm tells minutes so that will certainly give a problem months are MM,
however better is in my opinion as I said in my other message to keep it
with the dateTime and use that for comparasing and not the string.
Which means that you can use the Calender1.value and the Calender2.value for
comparing.
In VBNet you can do this by the way as simple as CalendarDate1 = Trim(Format(Calendar1.Value, "dd-mm-yy"))
dim CalendarDate1 as string = Cstr(Calendar1.Value).Format("dd-MM-yy")
or even more easy because the datetimepicker has this already in it
dim CalendarDate1 as string = Calendar1.Text.Format("dd-MM=yy")
I hope this helps?
Cor
Kurien,
It is funny in the newsgroup microsoft.public.dotnet.languages.vb there was
someone who had a kind same problem, it was seen directy in the code. (That
newsgroup is special for VBNet questions)
(I assume that Calendar1 is a datetimepicker because that has a value
property) Private Sub Calendar1_Click() CalendarDate1 = Trim(Format(Calendar1.Value, "dd-mm-yy")) Command1.Enabled = False MsgBox CalendarDate1 End Sub
That mm tells minutes so that will certainly give a problem months are MM,
however better is in my opinion as I said in my other message to keep it
with the dateTime and use that for comparasing and not the string.
Which means that you can use the Calender1.value and the Calender2.value for
comparing.
In VBNet you can do this by the way as simple as CalendarDate1 = Trim(Format(Calendar1.Value, "dd-mm-yy"))
dim CalendarDate1 as string = Cstr(Calendar1.Value).Format("dd-MM-yy")
or even more easy because the datetimepicker has this already in it
dim CalendarDate1 as string = Calendar1.Text.Format("dd-MM=yy")
I hope this helps?
Cor
Correction thanks to Jay dim CalendarDate1 as string = Cstr(Calendar1.Value).Format("dd-MM-yy")
Dim CalendarDate1 As String = Calendar1.Value.ToString("dd-MM-yy")
dim CalendarDate1 as string = Calendar1.Text.Format("dd-MM=yy")
Dim CalendarDate1 As String = CDate(Calendar1.Text).ToString("dd-MM-yy")
I should not have done this without IDE, to quick.
Cor
Correction thanks to Jay dim CalendarDate1 as string = Cstr(Calendar1.Value).Format("dd-MM-yy")
Dim CalendarDate1 As String = Calendar1.Value.ToString("dd-MM-yy")
dim CalendarDate1 as string = Calendar1.Text.Format("dd-MM=yy")
Dim CalendarDate1 As String = CDate(Calendar1.Text).ToString("dd-MM-yy")
I should not have done this without IDE, to quick.
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Donnal Walter |
last post by:
I was very surprised to discover that
>>> import datetime
>>> x = datetime.date(2004, 9, 14)
>>> y = datetime.datetime(2004, 9, 14, 6, 43, 15)
>>> print x == y
True
How can these two...
|
by: Scott Knapp |
last post by:
Good Day -
I have a form which sets the current date, as follows:
<script type="text/javascript">
xx=new Date()
dd=xx.getDate()
mm=xx.getMonth()+1
yy=xx.getYear()
mmddyy=mm+"/"+dd+"/"+yy...
|
by: sylvian stone |
last post by:
Hi,
I've used standard date functions in the past, but need to create
something a little different, as I am working on an investment
calculator.
What I need to do is validate two dates, and...
|
by: Karl Gibbon |
last post by:
Hi There,
I currently have a database in Access 2002 with several
forms. I would like to restrict access to one form in perticular until
November 1st every year. My current method (attempted...
|
by: MarkAurit |
last post by:
Im having difficulty coming up with a good algorithm to express the following
comparison:
"if <a given date> falls between the (current date - 5 days) and the
(current date)"
Obviously....
| |
by: Tiya |
last post by:
Hi there !!!
I would like to know how to compare dates in javascript.
var sdate = new Date(theform.SubmissionDate.value);
var odate = new Date(theform.StartDate.value);
var todaysdate = new...
|
by: blini |
last post by:
Helo.... How I can convert string "26/03/2006 15:51" for a date? I need
to convert and to compare if "09/06/2006 14:20" is lesser or equal that
the current date. Everything in Javascript.
|
by: mr.nimz |
last post by:
hello,
this is antenio. recently i've come to a problem. i got a way through
it, somehow, still it left me in a curious state, so i'm posting it
here, if i can get an answer from some techy,
...
|
by: noone |
last post by:
Hi,
I am designing an application which displays news topics until midnight
on the DisplayUntil date and then they should drop out. Unfortunately,
they seem to be dropping out at mid-day.
I'm...
|
by: anagai |
last post by:
I just want to check if a date entered in a textbox is equal to the
current system date. I set the date object from the input field like
this:
dt1=new Date('10/01/2007');
the current system...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |