Solved

datetime problem

Posted on 2003-12-05
2
200 Views
Last Modified: 2013-12-24
i have some datetime value in an employee database (datetime field in sql).  everytime i send over a blank value when i update or add something it comes back with 1/1/1900 value.  how do i send a blank value to a datetime field?

0
Comment
Question by:tpiazza
2 Comments
 
LVL 9

Accepted Solution

by:
shooksm earned 50 total points
ID: 9882702
First, use CFPARAM tag to set a default value:

<cfparam default="" name="FORM.SomeDateField">

Then use the CFQUERYPARAM tag and the NULL attribute on the date field:

<cfquery ...>
INSERT INTO SomeTable (SomeDateField)
        (<cfqueryparam cfsqltype="cf_sql_timestamp" null="#YesNoFormat(Trim(FORM.SomeDateField) EQ "")#" value="#FORM.SomeDateField#">)
</cfquery>

The cfqueryparam tags null attribute can be used to send a NULL value to the database, which is essentially a blank value as long as the field accepts null values.  The YesNoFormat function returns back a yes if the FORM.SomeDateField is blank and no if it contains data.
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9883443
Set default to null !
I dont see why u want to update it !
0

Featured Post

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.

Question has a verified solution.

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

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

815 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

13 Experts available now in Live!

Get 1:1 Help Now