What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 4903 |  Welcome, Guest!   Register  Login
 Home > Forums > ASP.NET > Regular expression ...
Sibin.rhythm

Regular expression

Replies: 5 | Posted by: Sibin.rhythm on 8/24/2009 | Category: ASP.NET Forums | Views: 610 | Status: [Member]  


I need regular expression for date in the given format
dd/mm/yyyy hh:mm am/pm

It will Never accept any other format
anybody help me????


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Lakhangarg
Lakhangarg  
Posted on: 8/24/2009 2:22:11 AM
Level: Silver | Status: [Member] [Moderator]

Hi-

Use This for dd/mm/yyyy format
(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d


Thanks & Regards
Lakhan Pal Garg
http://lakhangarg.blogspot.com/

Sibin.rhythm, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Sibin.rhythm
Sibin.rhythm  
Posted on: 8/24/2009 2:32:20 AM
Level: Starter | Status: [Member]

Thank you Lakhan Pal Garg ,

But I need expression not only for date but for Time also .

I need to type the textbox value in the following format

mm/dd/yyyy hh:mm am/pm

Wheather any body gives any other format of time and date , then the error message should display.

So please help me with the above format's regular expression....

Sibin.rhythm, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Lakhangarg
Lakhangarg  
Posted on: 8/24/2009 2:39:05 AM
Level: Silver | Status: [Member] [Moderator]

Hi-

Check out this: ^((((([13578])|(1[0-2]))[\-\/\s]?(([1-9])|([1-2][0-9])|(3[01])))|((([469])|(11))[\-\/\s]?(([1-9])|([1-2][0-9])|(30)))|(2[\-\/\s]?(([1-9])|([1-2][0-9]))))[\-\/\s]?\d{4})(\s((([1-9])|(1[02]))\:([0-5][0-9])((\s)|(\:([0-5][0-9])\s))([AM|PM|am|pm]{2,2})))?$

for more detail visit:
http://regexlib.com/Search.aspx?k=Datetime&c=-1&m=-1&ps=20

Thanks & Regards
Lakhan Pal Garg
http://lakhangarg.blogspot.com/

Sibin.rhythm, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Sibin.rhythm
Sibin.rhythm  
Posted on: 8/24/2009 2:45:21 AM
Level: Starter | Status: [Member]

Thankyou Mr.Lakhan Pal Garg

I am going to apply these code to my project.
I will contact u if there has more clarifications.

Thankyou once again

Sibin.rhythm, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Lakhangarg
Lakhangarg  
Posted on: 8/24/2009 3:02:56 AM
Level: Silver | Status: [Member] [Moderator]

You are welcome..
no problem you can contact me at any time??
:)

Regards
Lakhan Pal Garg

Sibin.rhythm, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

Found interesting? Add this to:


 Latest Posts

Write New Post | More ...

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/26/2013 2:42:05 AM