ASP.NET 1.1, this is a Intranet application and runs only on IE.
I have two webform text boxes which contain dates - starting date and ending
date. The dates could be in any format.
for example:
Starting date: 02/15/2006
Ending date: March 2006
I have to make sure the starting date is before the ending date
Because I open Word on the client when client clicks on the submit button I
have to validate these dates on the client.
How can I make sure these dates are in correct range? The CompareVaidator
does not work when starting and ending date are in different format.
The CompareValidato r makes the following an invalid
Starting date: 02/15/2006
Ending date: March 2006
but not this:
Starting date: 02/15/2006
Ending date: 03/01/2006
Thank you
Peter 3 2592
Hi Peter,
Welcome to the ASP.NET newsgroup.
From your description, I understand you have a certain ASP.NET web page
which contain two text field to let user input date time and you need to
compare the date/time in the two text fields. Since the input date's
format in the two text fields may vary, you're wondering a simple and
better means to compare them(the string format ), correct?
Based on my experience, since the input data in the text fields are of text
format and the format of the date/time may also vary, the better approach
maybe postback the page and parse the data in text field into .net DateTime
class instance and do the comparation. Is it posslbe that you do the work
at serverside like this?
For clientside, date/time parsing and format functionality are limited.
There does exists an Date class(javascrip t class object) which has parse
method and other client script methods, however not all the browsers will
support them. Anyway, here are some web article introduce use the
javascript Date object:
METHOD: Date::parse http://www.devguru.com/Technologies/...ate_parse.html http://www.comptechdoc.org/independe.../javadate.html
Thank you for your help!
I can not validate on the server because when the user clicks on the submit
button the program opens up a Word document, but I have to make sure the
dates are valid before I can open the Word document. If I do validation on
the server the Word opens up and then I get the error message.
"Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
news:AF******** *****@TK2MSFTNG XA01.phx.gbl... Hi Peter,
Welcome to the ASP.NET newsgroup.
From your description, I understand you have a certain ASP.NET web page which contain two text field to let user input date time and you need to compare the date/time in the two text fields. Since the input date's format in the two text fields may vary, you're wondering a simple and better means to compare them(the string format ), correct?
Based on my experience, since the input data in the text fields are of text format and the format of the date/time may also vary, the better approach maybe postback the page and parse the data in text field into .net DateTime class instance and do the comparation. Is it posslbe that you do the work at serverside like this?
For clientside, date/time parsing and format functionality are limited. There does exists an Date class(javascrip t class object) which has parse method and other client script methods, however not all the browsers will support them. Anyway, here are some web article introduce use the javascript Date object:
METHOD: Date::parse http://www.devguru.com/Technologies/...ate_parse.html
http://www.comptechdoc.org/independe.../javadate.html
Thanks for your quick response Peter,
Thus, I think you can need to struggle with clientside script api. Anyway,
you can find many web articles over internet newsgroup discussing on
scripting Date/Time data.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gleep |
last post by:
Hey Guys,
I've got a table called Outcomes. With 3 columns and 15 rows
1st col 2nd col 3rdcol
outcome date price
There are 15 rows for each record, each row accounts for a different type of outcome
I'm having trouble with MySQL date comparison. I'm looking for some kind of query that will compare
the all date column and only give me the latest date. Then once I have it, ...
|
by: Richard Hollenbeck |
last post by:
I'm trying to write some code that will convert any of the most popular
standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan
1908) and compare the first with the second and calculate days, months, and
years. This is not for a college course. It's for my own personal
genealogy website. I'm stumped about the code. I'm working on it but not
making much progress. Is there any free code available anywhere? I know it...
|
by: Stephen |
last post by:
Is there any way of using a compare validator to compare a textbox to see if
the date is greater than or equal to todays date. I want to set the
ValueToCompare property to now(). It doesn't seem to like this is there any
way around this problem
<asp:CompareValidator id="CompareValidator1" style="Z-INDEX: 103; LEFT:
431px; POSITION: absolute; TOP: 277px" runat="server"
ErrorMessage="CompareValidator" ControlToValidate="TextBox2"...
|
by: jty202 |
last post by:
I have string that contains a date in this format (14-Jan-05). I want to
store in date object if theres one and access each part of the date (month,
year, dates, day of week).
Specifically I want to convert it in this format 20050114 because this way,
I can compare it with another date in this format to see which is greater.
Can something show me how to do that. Thanks
|
by: James P. |
last post by:
Hello there,
In my asp.net page using VB, I have a date text field in mm/dd/yyyy
format. When a date is entered, I'd like to validate it to make sure
the date is greater than or equal to the current date. If not, I'd
like to display the error message to ValidationSummary.
It seems to make sense to me to use CompareValidator but the problem
is put the current date into CompareValidator. So, I created a hidden
text field in my aspx. ...
| |
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: Budd |
last post by:
Hi everyone
i got a problem on date, it is...
1, i get the date from calendar component
2, compare today and selected date is equal (compare method)
3 count the number of day between this 2 date
|
by: Assimalyst |
last post by:
Hi,
I have a working script that converts a dd/mm/yyyy text box date entry
to yyyy/mm/dd and compares it to the current date, giving an error
through an asp.net custom validator, it is as follows:
function doDateCheckNow(source, args)
{
var oDate = document.getElementById(source.controltovalidate); //
dd/mm/yyyy
|
by: vrparekh |
last post by:
in my webapplication,user pick date in dd/mm/yy format,
and i want to compare that date with another date using compare validator but
compare validator compare the dates using mm/dd/yy format.
is there any way to change the format of date,used by compare validator.??
vishal parekh
|
by: deepikashalini |
last post by:
hi,
Im storing Issue date in database.
Issuedate stored as varchar.
and then compare to Passing string date('03/06/2008')
what is query to compare storing varchar date to passing string date.
its only compare date only. not compare month,year.
i want to compare date,month,year all things.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |