Solved

Inserting and modifying dates on SQLSERVER 7.0 ( danish format )

Posted on 2002-04-07
8
171 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
[X]
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
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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

627 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