Hello,
What is the best way to validate a textbox to see if it contains a valid
date or a valid time or both?
Thanks
Frank 4 1903
You could either cast the value as a date and catch the exception if it
isn't one, or you could read up on Regular Expressions and use one to
validate the format.
RegExs are more elegant, but catching the exception is quick, dirty, and
effective.
"Frank Rocco" <fa*****@hotmail.com> wrote in message
news:eu**************@TK2MSFTNGP12.phx.gbl... Hello,
What is the best way to validate a textbox to see if it contains a valid date or a valid time or both?
Thanks
Frank
Thanks Jeff, I'll look at the RegExp option.
Anyone have one already coded?
This seems like it would be a common thing to have.
Regards,
Frank
"Jeff Molby" <JeffMolby@C_mc_st.n_t> wrote in message
news:up*************@TK2MSFTNGP10.phx.gbl... You could either cast the value as a date and catch the exception if it isn't one, or you could read up on Regular Expressions and use one to validate the format.
RegExs are more elegant, but catching the exception is quick, dirty, and effective.
"Frank Rocco" <fa*****@hotmail.com> wrote in message news:eu**************@TK2MSFTNGP12.phx.gbl... Hello,
What is the best way to validate a textbox to see if it contains a valid date or a valid time or both?
Thanks
Frank
I don't have any code, but I'm sure it's out there somewhere. I refer you to
the almighty Google http://www.google.com/search?hl=en&l...date+date+time
Correction: Instead of casting it as a date, you'll probably want to try
DateTime.Parse() instead. http://www.dotnet247.com/247referenc...30/150304.aspx
"Frank Rocco" <fa*****@hotmail.com> wrote in message
news:up*************@TK2MSFTNGP12.phx.gbl... Thanks Jeff, I'll look at the RegExp option. Anyone have one already coded? This seems like it would be a common thing to have.
Regards,
Frank
"Jeff Molby" <JeffMolby@C_mc_st.n_t> wrote in message news:up*************@TK2MSFTNGP10.phx.gbl... You could either cast the value as a date and catch the exception if it isn't one, or you could read up on Regular Expressions and use one to validate the format.
RegExs are more elegant, but catching the exception is quick, dirty, and effective.
"Frank Rocco" <fa*****@hotmail.com> wrote in message news:eu**************@TK2MSFTNGP12.phx.gbl... Hello,
What is the best way to validate a textbox to see if it contains a
valid date or a valid time or both?
Thanks
Frank
Thanks for the help Jeff. That's what I needed.
Regards,
Frank
"Jeff Molby" <JeffMolby@C_mc_st.n_t> wrote in message
news:Om**************@tk2msftngp13.phx.gbl... I don't have any code, but I'm sure it's out there somewhere. I refer you
to the almighty Google http://www.google.com/search?hl=en&l...date+date+time
Correction: Instead of casting it as a date, you'll probably want to try DateTime.Parse() instead. http://www.dotnet247.com/247referenc...30/150304.aspx
"Frank Rocco" <fa*****@hotmail.com> wrote in message news:up*************@TK2MSFTNGP12.phx.gbl... Thanks Jeff, I'll look at the RegExp option. Anyone have one already coded? This seems like it would be a common thing to have.
Regards,
Frank
"Jeff Molby" <JeffMolby@C_mc_st.n_t> wrote in message news:up*************@TK2MSFTNGP10.phx.gbl... You could either cast the value as a date and catch the exception if
it isn't one, or you could read up on Regular Expressions and use one to validate the format.
RegExs are more elegant, but catching the exception is quick, dirty,
and effective.
"Frank Rocco" <fa*****@hotmail.com> wrote in message news:eu**************@TK2MSFTNGP12.phx.gbl... > Hello, > > > What is the best way to validate a textbox to see if it contains a valid > date or a valid time or both? > > Thanks > > Frank > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Megha Vishwanath |
last post by:
Hi,
We have an application where my clients may be at different timezones.
I need to validate time across the timezones with javascript. The date
object in JavaScript does not allow me to get...
|
by: mike |
last post by:
Hello,
After trying to validate this page for a couple of days now I was
wondering if someone might be able to help me out. Below is a list of
snippets where I am having the errors.
1. Line 334,...
|
by: paulsmith5 |
last post by:
Hi,
I have the following regular expression to validate a date-time field
in European or d/m/y h:m:s format.
...
|
by: Jack Addington |
last post by:
I've got a fairly simple application implementation that over time is going
to get a lot bigger. I'm really trying to implement it in a way that will
facilitate the growth. I am first writing a...
|
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...
|
by: Kum |
last post by:
Hi,
I need help in asp.net dynamic textbox controls
validation.
I am creating textbox controls dynamically on a
asp.net webpage. Now after creating the textboxes on
the page I want to validate...
|
by: Q. John Chen |
last post by:
I have Vidation Controls
First One: Simple exluce certain special characters:
say no a or b or c in the string:
*
Second One:
I required date be entered in "MM/DD/YYYY" format:
//+4 How...
|
by: D |
last post by:
Hello all...I have an issue with one of my java script functions that
I'm hoping someone can easily help with. I have a web based application
that we use to create/sign up for overtime. When we...
|
by: gunimpi |
last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431
********************************************************
VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
wanted...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
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: 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...
|
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...
| |