Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Isdate, checking Formatting too e.g. dd/mm/yyyy

4 views
Skip to first unread message

Rob W

unread,
Dec 6, 2007, 6:28:25 PM12/6/07
to
Greetings,

I've used the IsDate successfully to check if a date within a text box is
valid.

When you enter the textbox the date is set to todays date and formatted
dd/mm/yyyy
txtDateAdmitted.Value = Format(Now, "dd/mm/yyyy")

However I would like to be flexiable and allow the user to enter date in any
format and then later apply the formatting of 'dd/mm/yyyy'
So far I have done this aslong as ISdate(textbox1.value) returns TRUE.

However to be more efficent how do I check the ISDate and the format is
dd/mm/yyyy ??

I've tried below but its syntically incorrect.

ElseIf IsDate(txtDateAdmitted.Value) And Not Format(txtDateAdmitted.Value,
"dd/mm/yyyy") Then


Cheers
Rob W


Dave Peterson

unread,
Dec 6, 2007, 6:53:29 PM12/6/07
to
For the most part, I don't think you can.

How will your program ever decide what I meant when I typed:

01/02/2007

Should it be processed as January 2, 2007 or should your code treat it as
February 1, 2007?

You may want to drop the textbox and use an unambiguous way of getting the date.

Ron de Bruin shares calendar control instructions here:
http://www.rondebruin.nl/calendar.htm

--

Dave Peterson

sunitpulikottil

unread,
Nov 22, 2009, 5:49:24 AM11/22/09
to
try this function:
=if(iserror(date(0,1,1)-Y5),"NotDate","date")

Y5 is the cell address
y5 should be in dateformat
you may use 0 and 1 instead "notdat","date"

Rob W wrote:

Isdate, checking Formatting too e.g. dd/mm/yyyy
06-Dec-07

Greetings,


Cheers
Rob W

Previous Posts In This Thread:

On Thursday, December 06, 2007 6:28 PM
Rob W wrote:

Isdate, checking Formatting too e.g. dd/mm/yyyy
Greetings,


Cheers
Rob W

On Thursday, December 06, 2007 6:53 PM
Dave Peterson wrote:

For the most part, I don't think you can.
For the most part, I don't think you can.

How will your program ever decide what I meant when I typed:

01/02/2007

Should it be processed as January 2, 2007 or should your code treat it as
February 1, 2007?

You may want to drop the textbox and use an unambiguous way of getting the date.

Ron de Bruin shares calendar control instructions here:
http://www.rondebruin.nl/calendar.htm

Rob W wrote:

--

Dave Peterson

EggHeadCafe - Software Developer Portal of Choice
Use Assembly Helper Class to retrieve Information on any assembly
http://www.eggheadcafe.com/tutorials/aspnet/d9c4830c-4522-48c6-80aa-e463a6ec1436/use-assembly-helper-class.aspx

0 new messages