ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 10th, 2005, 06:51 AM
wonderlandh wonderlandh is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Nottingham UK
Posts: 60 wonderlandh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 48 m 31 sec
Reputation Power: 4
"dd/mm/yyyy" not "mm/dd/yyyy" !!!!!!

I have this:

Code:
<cfquery name="getdate" datasource="datasource">
SELECT EventDate
FROM Events
WHERE EventTitle = '#title#'
</cfquery>


With which I do this:

Code:
<cfset date = dateformat(getdate.EventDate,"dd/mm/yyyy")>


And so #date# will read 9/8/2005 for example. Which translates
as 9th August 2005 (dd/mm/yyyy). Fine.

When I go to take that variable #date# and stick it in the
database (the collumn is datetime) it ALWAYS goes in as
mm/dd/yyyy no matter what I seem to do.

I have tried this:

Code:
<cfquery name="add_details" datasource="HMCEOnline">
INSERT
INTO reg_interest ("emailadd","eventname","eventdate")
VALUES ('#email#','#title#', '#DateFormat(CreateODBCDateTime(getdate.EventDate), "dd/mm/yyyy")#')
</cfquery>


As well as just '#date#' which I figured would transfer it as
text.

Any ideas???

Reply With Quote
  #2  
Old August 10th, 2005, 08:00 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
A date field in a database has a specific format that actually looks nothing like '9/8/05'. Is this a date data type in the database? If so you will need to format the date the way you would like to when you perform a query.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Last edited by kiteless : August 10th, 2005 at 08:02 AM.

Reply With Quote
  #3  
Old August 10th, 2005, 08:19 AM
wonderlandh wonderlandh is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Nottingham UK
Posts: 60 wonderlandh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 48 m 31 sec
Reputation Power: 4
I just need some clarification on that. Not 100% with you.

The data type is a datetime, yes.

When you say:

"you will need to format the date the way you would like to when you perform a query"

What do you mean exactly? because i do format the date once it's been fetched from the DB (see: cfset date = bla bla)

And it goes in fairly ok as mm/dd/yyyy but should be dd/mm/

Could you just clearify at all?

Many thanks

Reply With Quote
  #4  
Old August 10th, 2005, 08:34 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
That's the thing, YOU think it's going in like '9/8/05' or '8/9/05' or whatever, but a date/time value is actually stored in a very specific way in the database (which varies from vendor to vendor). But the point is, there is no way to tell the database to save a date in a date/time field with a specific "format"...there is no format as far as the database is concerned.

Reply With Quote
  #5  
Old August 10th, 2005, 08:49 AM
wonderlandh wonderlandh is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Nottingham UK
Posts: 60 wonderlandh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 48 m 31 sec
Reputation Power: 4
bingo.

I just had it go in straight, without any formatting, from
SELECT result to INSERT, i let it go in unformatted and
that did the trick.

many thanks, you've been a great help

Reply With Quote
  #6  
Old August 10th, 2005, 09:47 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
Happy to help! Yep, it just means you need to do any formatting when you pull the data out (preferrably in the SQL statement itself using whatever date formatting or string formatting functions your database has available).

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > "dd/mm/yyyy" not "mm/dd/yyyy" !!!!!!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT