473,473 Members | 1,488 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Validate DateTime pattern

Hi,
How i can check if a string is a valid DateTime pattern?
In java i can use the class SimpleDateFormat that throw an exception when is
initialized with an invalid datetime pattern. There is any class in C# that i
can use?

"yyyyMMdd" --> Correct format pattern
"dd44fgfd" --> Incorrect format pattern

Thanks in advance
Nov 16 '05 #1
1 6934
Try DateTime.ParseExact(). If it throws exception then, then the string is
not in the expected format.

"diemos" <di****@discussions.microsoft.com> wrote in message
news:7B**********************************@microsof t.com...
Hi,
How i can check if a string is a valid DateTime pattern?
In java i can use the class SimpleDateFormat that throw an exception when is
initialized with an invalid datetime pattern. There is any class in C# that
i
can use?

"yyyyMMdd" --> Correct format pattern
"dd44fgfd" --> Incorrect format pattern

Thanks in advance
Nov 16 '05 #2

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

Similar topics

1
by: antao | last post by:
I'm keeping in the database a log of all the sessions for my application. I'm trying to write a stored procedure that returns all the sessions that; the login contains a certain string, loggedin...
1
by: Paul Cheevers | last post by:
Hi, I've been trying to write some schema to validate the Value element of an Eq element but to no avail. If the Value Element is off type DateTime then the node should be able to contain text...
6
by: RSB | last post by:
Hi Every one Need some help to Validate the Date i have in the Form. ALso how to Convert the Date Data i read from table to yyyy/MMM/dd format. Thanks RSB
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...
9
by: Phil B | last post by:
I am having a problem with a datetime from a web services provider The provider is sending the following SOAP response <?xml version="1.0" encoding="utf-8"?> <soap:Envelope...
2
by: prabhuram.k | last post by:
Can anybody know how to validate IPV4 and IPV6 address in PHP. I am using PHP 4.2.3 for some compatiability reason.
3
by: sean_tor_on | last post by:
Hi all, Haven't figured out a way to validate the xml below: <root> <e1 e2="type1list_1" /> <e1 e2="type2list_1" /> .... <e1 e2="type2list_m" />
6
by: NH | last post by:
I want to allow users to enter dates in a text box in either the US "MM dd yy" format or the UK "dd MM yy" format. But how can I validate these dates? All the date functions e.g. ISdate,...
3
by: John Wright | last post by:
I want to validate an email address against our Exchange server. Anyone have code or point me in the right direction? John
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
marktang
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,...
0
Oralloy
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,...
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.