473,396 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Date Compare

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 CompareValidator 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
Feb 15 '06 #1
3 2571
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(javascript 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

Feb 16 '06 #2
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*************@TK2MSFTNGXA01.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(javascript 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

Feb 16 '06 #3
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.)

Feb 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
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...
4
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...
4
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...
4
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...
7
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...
4
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.
1
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...
12
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...
1
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. ...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
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...
0
tracyyun
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.