A few things to try:

1. Insert today's date as well as the time.  Since you don't care, it
won't make a diff if you use today or last century.  Or, pick your
anniversary, birthday or whatever.  Once you choose a date, stick with
it and this will let you perform some valid time math, if needed.

2. Make sure you don't have any timezone conversion happening anywhere.
When you say you enter 6:00, but get 12:00, it's like you are living in
the Central Time Zone and it is getting converted, so to speak.

3. Type the exact same ancient date into Enterprise Manager and see if
it is converted at that point.  That will rule out ColdFusion.

M!ke

-----Original Message-----
From: Pete Ruckelshaus [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 30, 2005 10:41 PM
To: CF-Talk
Subject: Stuck on saving times in a SQL server database

I'm stuck.  Could be just because it's late, but I'm not getting
anywhere.

I'm writing a scheduling application to make my wife's life a bit
easier.  One of the tables will contain standard shift times for
employees, i.e. 7:30-16:00, 8:30-17:00.  I use these values to populate
a dropdown that a person's shift can be selected from.

So, I'm trying to store these time values in a SQL Server database. 
Table is something like:

tblScheduledTimes
timestart(datetime)
timeend(datetime)

The administrator then enters shift start/end times in HH24:mm format

The problem I am having is on inserting those values into the database.
If I try to insert the value as <cfqueryparam cfsqltype="CF_SQL_DATE"
value="#timeFormat(FORM.timestart)#">  With debug output turned on, I
can see that the value being inserted is {ts '1899-12-30 16:00:00'},
which is correct (remember, I don't care about the date, just the time).

However, viewing the actual data in the database, that value is being
stored as 12/30/1899 12:00:00 PM

Anyone have a clue as to why the value being inserted is correct, but
the value being actually stored isn't?  Should I be using a different
data type?  Should I just store the time value (i.e. 16:00) as a varchar
value and convert it to part of the date when I store the actual
employee schedule time in the schedule table (which is not the table
shown above)?

Thanks,

Pete

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219823
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to