Forums

ASP

This topic is locked

Convert Date in a Form Field

Posted 13 Nov 2006 02:42:01
1
has voted
13 Nov 2006 02:42:01 Robert Robinette posted:
I've searched the forum and can't find a problem like mine - although this may be very simple for some of you.

I'm trying to pass two dates from a form and use them as variables in a SQL select statement. Everything works properly, but to make it work I have to enter the dates in the form field in MySQL date format - yyyy-mm-dd.

Is there a way to allow the user to enter the date in another format mm/dd/yyyy, pass the date as a variable in MySQL date format, and still make the SQL query work?

Thanks to anyone who can point me in the right direction.

Replies

Replied 14 Nov 2006 13:23:43
14 Nov 2006 13:23:43 Steve Bedder replied:
You need to change\set the locale value...

Do a search for LCID, you'll need to set the session locale to give you the date format you require.

e.g. Session.LCID = 2057 sets UK date format - dd/mm/yyyy where as Session.LCID = 1033 sets English US mm/dd/yyyy

HTH

SteveB

www.stockportcounty.net
XHTML | ASP | SQL 2005 | Access

Reply to this topic