473,785 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Checking for a valid date

What's the easiest way to verify the user had entered a valid date ?
Nov 21 '05
28 2040
"Jason Pettys" <pe****@nospam. nospam> schrieb
Armin Zingler wrote:
"Jason Pettys" <pe****@nospam. nospam> schrieb
Extracted from full quote below:

> As a string input is usually taken from
> the user - you know, the slowest part of the chain - there is
> absolutely no need to optimize this process.

If you had a high-traffic ASP.NET site with a lot user-entered
date validation required, is there still "absolutely no need to
optimize this process"?

If you have one user sitting in front, is there any reason to
forbid Try/Catch?


I don't understand your question.


Just like I didn't understand yours.
As I said in my first reply to
the OP: "It probably wouldn't matter much on a Win Forms app, but I
would really back away from this on ASP.NET if you're expecting any
volume of traffic."
I didn't know the client machine is not able to check this. Such a lot of
resources wasted!
In the latter case I would anticipate that a lot of unnecessary
exceptions would cause a noticeable performance penalty. In the
former case I think one could get by with a Try/Catch. I guess my
point was that there are cases where optimization should be a
concern even when the only validation is of user-entered data, and
one should be aware of both sides when picking how to validate
dates.

Don't you agree that a developer should be aware that in some cases
the exception-based approach can be a performance problem?


I do agree. What I explained in my previous post: If you want to use
date.parse, you must use try/catch for the reasons given. By saying "use
date.parse" I mean "permit the format(s) that date.parse permits". If you
don't use date.parse, it's up to you, of course.

Armin

Nov 21 '05 #21
Jason,

I find it a much larger problem that I cannot find how to get the
language/culture setting the client is using on the serverside.

Therefore I have probably only seen on a webpage three textboxes with day,
month, year while that is than checked using javascript. That gives as extra
(not that important) few traffic.

However if you have a very good method to get the language/culture setting
from the client on server side, than I will be much obliged.

Just my thought,

Cor
Nov 21 '05 #22
Cor,

an OT question: do you see my reply to Jason from today, 02:03 AM? When I
posted the message (and two other messages), it appeared in my OE as a new
message, but when I clicked on it, it was thriked through as if it has been
deleted from the server (and I did not delete it). As written above, this
happens to another message, but I did get a reply to it, so I think it must
have been on the server. It was a message in the thread "How to compare
objects using their typecode". I can see only one answer from me from 22:29
yesterday, but not the one from today, 02:46. Do you see still it?

Thx a lot, Cor, if you could have a look, and sorry ppl for asking here!

Armin

P.S: I also have the problem that I am told about 6 new messages in this
group (since Sunday) but when I try to download them they don't seem to
exist - then they are back again...and gone...there... gone... :( Maybe I
should reset my news reader.

Nov 21 '05 #23
Cor,

Stooop! I reset the group in the news reader and eveything seems to be fine
now. Sorry for wasting your time (if you already did ;-) )! (I should have
done this before...)

Armin

Nov 21 '05 #24
Armin,

I was starting to hanlde it, glad you messaged this (what I would expect
from you)

I don't know how fast at the moment your connection is. However some months
they had not set the retention time. The newsgroups where growing and
growing.

You understand probably what this means for dial up users.

Now it is luckily 2 months again.

Cor
Nov 21 '05 #25
"Cor Ligthert" <no************ @planet.nl> schrieb
I was starting to hanlde it, glad you messaged this (what I would
expect from you)

I don't know how fast at the moment your connection is. However some
months they had not set the retention time. The newsgroups where
growing and growing.

You understand probably what this means for dial up users.

Now it is luckily 2 months again.

As I still have the problem that there are 7 new posts that disappear as
quickly as they appeared, I activated NNTP logging. From the log file I see
that there seems to be something going on on the server. Very short example
(lines received from the news server):

13:39:30 [rx] 211 9083 276748 285823 microsoft.publi c.dotnet.langua ges.vb
13:42:15 [rx] 211 29394 1 285825 microsoft.publi c.dotnet.langua ges.vb

The 3 numbers after 211 are:
9083 = approximate number of posts in the group
276748 = number of first article
285823 = number of last article

As you see in the second line (only 3 mins later) the numbers changed
totally. This happens almost each time the group is accessed. Well, let's
wait till this stops.
I write this here because others might also have problems with this group
(not with the ppl but the download ;)

Armin

Nov 21 '05 #26
Armin,

Your message as reply to Jason I see in my newsreader.
I replied it as well with a complete different text, because I find it a
long time a problem that I cannot get the used culture/language on the
client computer when he is using IE, and maybe Jason has an answer for that.

This is a part of your message
I don't understand your question.

Just like I didn't understand yours.
You know that Google is great now with these newsgroup.
This is this thread
http://groups-beta.google.com/group/...8e2533ae754cae

This is the address to it
http://groups-beta.google.com/group/...n&lr=&ie=UTF-8

Cor
Nov 21 '05 #27
"Armin Zingler" <az*******@free net.de> schrieb:
P.S: I also have the problem that I am told about 6 new messages in this
group (since Sunday) but when I try to download them they don't seem to
exist - then they are back again...and gone...there... gone...


The same here...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #28
The easiest way is to use the DateTime Picker for user input to ensure he
inputs a valid date.
--
Dennis in Houston
"romy" wrote:
What's the easiest way to verify the user had entered a valid date ?

Nov 21 '05 #29

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

Similar topics

8
2766
by: John V | last post by:
What kind of regular expression pattern is needed to check if URL is valid? It's enought if most of cases are covered. I have PHP 4.x. Br
7
7601
by: - ions | last post by:
I have created a JComboBox with its Items as a list of "M" numbers ie. M1,M2,M3.......throgh too M110 (thes are the messier objects, a catolouge of deep sky objects) the user selects of of these and views it aswell as infomation. The program also has a JTextFiels which allows the user to enter the M number. The problem i have is checking that what the user has entered is valid, that being an M followed by 1 - 110 Nothing else, i thought of...
67
4285
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. Unfortunately these ad hominem rhetorts are frequently introduced into purely technical discussions on the feasibility of supporting such functionality in C++. That usually serves to divert the discussion from the technical subject to a discussion of the...
4
4607
by: SQLScott | last post by:
I have created a VB.Net app that takes data from Visual Foxpro and inserts it into SQL Server. The problem I am running into is that I have come across records in Foxpro where the dates are as follows: '08/08/0997 12:00:00 PM' Obviously, SQL Server does not accept 0997 as a valid date, and the back of my mind is asking why is Foxpro even allowing this. But anyway, my question
11
33323
by: Bob Day | last post by:
The IsDate code below should result in False, instead it throws the exception below. Why? How do I check if a string can be converted to a date if this function does not work properly? Bob code: Dim blnDate_Valid As Boolean = True Dim x As String = "Hello"
4
2386
by: Patient Guy | last post by:
Does anyone have any coding rules they follow when doing argument checking? When arguments fail during check, do you return from the call with an ambiguous return value, or do you throw exceptions?
17
5284
by: Petyr David | last post by:
Just looking for the simplest. right now my perl script returns an error messge to the user if the date string is invalid. would like to do this before accessing the server. TX
7
14198
by: kannushree | last post by:
i have built a program ,that checks wheteher a date is valid or not. now if i want to add date,month year (in same input) to a particular date,,how wud the logic work? it should be like dis : void add(int d, int m,int y)
6
2138
by: Mike P | last post by:
How do I check for a valid datetime, where both the date and the time must be entered in the format DD/MM/YYYY HH:MM? Using Convert.ToDateTime would work even if a time is not added so I can't use this? *** Sent via Developersdex http://www.developersdex.com ***
0
10152
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 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...
1
10092
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,...
0
9950
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 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...
0
8974
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
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
2
3650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
bsmnconsultancy
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...

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.