Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Inserting and modifying dates on SQLSERVER 7.0 ( danish format )

Posted on 2002-04-07
8
169 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Suggested Solutions

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

840 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