Solved

UK Dates

Posted on 2003-11-11
7
306 Views
Last Modified: 2013-12-24
Hi

I'm using a MySQL database and I'm trying to insert a date into it using a web form in the format DD/MM/YY (UK style)  01/11/03 - 1st Novmeber 03.

When I insert a date using a form I use the following code:

<cfqueryparam value="#FORM.APPLY_BY#" cfsqltype="cf_sql_timestamp">

But when I display the value on a web page, I find that the database has inserted my date as MM/DD/YY (US Style)  01/11/03 - 11th January 03.

How can I change the insert code, so that it can be inserted DD/MM/YY?

Thanks in advance
0
Comment
Question by:nelliott
7 Comments
 
LVL 10

Expert Comment

by:Mause
ID: 9723182
try LSDateFormat()

Mause
0
 

Author Comment

by:nelliott
ID: 9723257
I already am.  I'm displaying it as so:

#LSDateFormat(jobs.APPLY_BY,'DDDD, MMMM DD YYYY')#

It's the entering the data I need to get sorted, not the displaying I think....
0
 
LVL 5

Accepted Solution

by:
dc197 earned 250 total points
ID: 9724077
I always do one of the following:

1.  Use an ODBC date format:  {ts '2003-11-01 10:20:30'}
    <cfset UkDate = CreateODBCDate("#Now()#")>
    <cfset UkDate = CreateODBCDateTime("#Now()#")>


2.  Format using long month names, removes ambiguity:
       <cfset UkDate = DateFormat("#Now()#"  ,    "dd mmm yyyy")  >
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9728441
let the date will be inserted in the default database format !

change the display when u r displaying it on the browser - using dateformat()

OR chnage the default date settings for ur DB !

HTH

K'Rgds
Anand
0
 
LVL 5

Expert Comment

by:dc197
ID: 10999558
OK by me :-)
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now