Solved

Inserting and modifying dates on SQLSERVER 7.0 ( danish format )

Posted on 2002-04-07
8
166 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
 
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 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