Solved

Inserting and modifying dates on SQLSERVER 7.0 ( danish format )

Posted on 2002-04-07
8
170 Views
Last Modified: 2013-12-24
Hi,

The case is :

I use SLQ Server 7.0 as database for my application and I'm trying to insert dates passes from a form into a datetime field in a table. However EVERYTIME I do so the dates get completely 'f..... up'. I've tried almost everything, ex. CreateODBCDate, Dateformat LSDateformat functions etc.

THE DATEFORMAT has to be dd-mm-yyy ( DANISH STYLE )

I think it maby has something to do with the Database settings...does anyone know how to set this up ?

/Kenneth
0
Comment
Question by:kennethlowe
8 Comments
 

Author Comment

by:kennethlowe
ID: 6923854
Well, I found a solution to the problem myself on the Macromedia Website...hope other can use it :

http://webforums.macromedia.com/coldfusion/messageview.cfm?catid=6&threadid=302059&highlight_key=y&keyword1=insert%20date

/Kenneth
0
 

Expert Comment

by:manonng
ID: 6927884
Hi

I think you have set your sql's dateformat as GB or US,
Use 'set dateformat dmy', more details in sql help file.

manon
 
0
 
LVL 6

Expert Comment

by:reitzen
ID: 6928970
I feel your pain, my brotha!  I had the same frustrating experience.  Here's what I came up with.

Since CF passes everything as a string; pass it to the stored procedure as a string. Then convert it to your date type before inserting it.

The variable that is going to accept my date/time value is:
        @event_date     varchar(50)

After the first BEGIN I declare my date/time variable and then convert the varchar to the date/time data type:
        declare @ConvertDate datetime
        select  @ConvertDate = Convert(datetime, @event_date)

Then, simply insert/update your date/time field using the converted @ConvertDate variable.

If you are not using stored procedures, I have had pretty good luck by simply surrounding my CF date/time variable with single quotes:
        myDateTimeField = '#Variables.dDateTime#'

HTH
Rob
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 1

Expert Comment

by:dawesi
ID: 6939507
I'm also in your boat, using Australian dates...grrr..

I resorted to formatting the dates in literal format and dumping them into the ODBCDateTime('1 Jan 2002') function.

or you can use this sort of thing (If it works on your server)

<CFSet temp = SetLocale("English (Australian)")>
<CFSet Date2 = CreateODBCDateTime(LSDateFormat(Date,'dd/mm/yy'))>
0
 
LVL 1

Expert Comment

by:dawesi
ID: 6939509
PS:
Australia Style for dates dd/mm/yyyy
locale = English (Australian)

German Style for dates dd-mm-yyyy
locale = German (Standard)
0
 
LVL 17

Expert Comment

by:anandkp
ID: 7176390
Hi there,

<cfset countjan="#ListValueCount(testlist,'01','/,')#">

u can "n" delimeters for a list & in ur case :

use 2 delimeters to get the desired output - it surely would give u the right answere.

also enclose '01' in single quote !!!

let me know

K'Rgds
Anand
0
 
LVL 17

Expert Comment

by:anandkp
ID: 7176394
Hi,

SORRY ABT THIS - it wasnt meant for U !!!

pls reject it !!!

SORRY ONCE AGAIN !!!

Anand
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 8300770
PAQ'd and points refunded.

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Interesting problem when moving between environments 6 57
IIS Site Configuration Copy 2 82
Question to locate the problem 18 132
apply ddos protection on all network interface 2 130
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 …
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

726 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