Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date constraints

Status
Not open for further replies.

jkscript

Programmer
Joined
Jun 20, 2002
Messages
9
Location
GB
Hi all,

I'm trying to setup a constrain in table so that a date field conforms to a specific mask.

In ORACLE, it's something like

CONSTRAINT constraint_name
CHECK date_field
LIKE TO_DATE("DD/MMM/YYYY")

But I'm using MySQL?

Anyone know how I can port this???


Cheers
 
I have a date field. and I want the data to be stored as
DD/MON/YYYY

how can I ensure this?

Cheers
 
All MySQL dates are stored as YYYY-MM-DD -- that is its only available internal representation. There is no way to change that short of editing the source code and recompiling -- not something I recommend.

However, you can retrieve dates in any reasonable format you want using MySQL's date_format() function. ______________________________________________________________________
TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top