Solved

datetime problem

Posted on 2003-12-05
2
204 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
[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
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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

719 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