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 2765
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: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |