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

Home Posts Topics Members FAQ

javascript code for validating the time accepted in the form of string

7 New Member
Accepting the String in normal text box and checking weather the srting is Date or not in javascrit
Oct 26 '08 #1
5 1766
acoder
16,027 Recognized Expert Moderator MVP
Please provide more details include your code. What would be considered a valid date/time?
Oct 26 '08 #2
sunarb
7 New Member
Please provide more details include your code. What would be considered a valid date/time?
i need the code for checking weather the enterd string by user is valid time or not in very short code......
Nov 2 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
I understood that much, but that's not enough. What would be considered valid, e.g. 12 hour format, 24 hour, just numbers and ":" or "AM/PM" too and so on.

You can use a regular expression to validate the field, but post your code. What have you managed so far?
Nov 2 '08 #4
sunarb
7 New Member
i need the code for checking weather the enterd string by user is valid time or not in very short code......
i have no code.but had a query saying that write the code for checking wheather the given string in time or not
Nov 12 '08 #5
acoder
16,027 Recognized Expert Moderator MVP
Since you refuse to provide more details, I'll just give you a general idea.

Match the format first using a regular expression, e.g.
Expand|Select|Wrap|Line Numbers
  1. /^\d{1,2}\:\d{2}\:\d{2}(\s?(AM|PM))?$/i
then check each part individually for correctness, e.g. that hours is between 0 and 12, that minutes are between 00 and 59 and so on.
Nov 13 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

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
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
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...
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
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 ...

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.