Solved

Coverting ODBC DateTime back to coldfusion DateTime

Posted on 2003-10-23
9
312 Views
Last Modified: 2013-12-24
Hey!

I'm trying to convert a ODBC date time object back to coldfusion date time in order to see if two variables are equal. What is the function to do this?

Cheers Brad
0
Comment
Question by:bradderick
[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
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 15

Expert Comment

by:danrosenthal
ID: 9611779
try parsedatetime()
0
 

Author Comment

by:bradderick
ID: 9611835
I've tried that and it doesn't seem to work....

what I've got is a ODBC datetime variable alreadyinserted.begindate and a coldfusion date time variable Begindate. Here's the context I;m using it in.....it doesn't generate an error, just doesn't work

<CFSET BeginDate = Now()>  

<CFSELECT NAME="BeginDate" REQUIRED="YES" MESSAGE="You must select a valid begin date">
          <CFLOOP FROM="1" TO="30" INDEX="i">
            <CFOUTPUT>
              <OPTION VALUE="#BeginDate#"<CFIF parsedatetime(AlreadyInserted.BeginDate) EQ BeginDate>SELECTED</CFIF>>#LSDateFormat(BeginDate,"DDD DD MMM YY")#</OPTION>
              <CFSET BeginDate = DateAdd('D', 1, BeginDate)>
            </CFOUTPUT>
          </CFLOOP>
        </CFSELECT>
0
 

Author Comment

by:bradderick
ID: 9611844
I'm trying to see if any of the values in the drop down list are the same as the date in the database and if so select it.

I've put in test data for a case where an item should be selected, however it doesn't, leading me to conclude that a ODBC date time cannot EQ a coldfusion date time
0
Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

 
LVL 11

Accepted Solution

by:
hart earned 200 total points
ID: 9612112
try this out and let me know

<CFSET BeginDate = Now()>  

<CFSELECT NAME="BeginDate" REQUIRED="YES" MESSAGE="You must select a valid begin date">
         <CFLOOP FROM="1" TO="30" INDEX="i">
           <CFOUTPUT>
              <OPTION VALUE="#BeginDate#"<CFIF DateFormat(AlreadyInserted.BeginDate,'dd/mm/yyyy') EQ DateFormat(BeginDate,'dd/mm/yyyy')>SELECTED</CFIF>>#LSDateFormat(BeginDate,"DDD DD MMM YY")#</OPTION>
             <CFSET BeginDate = DateAdd('D', 1, BeginDate)>
           </CFOUTPUT>
          </CFLOOP>
       </CFSELECT>

Regards
Hart
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9612141
use DateFormat()

like :

#dateCompare(dateFormat(ODBCDAte,'dd,mm,yyyy'), dateformat(cfdate,'dd,mm,yyyy')#

HTH

let me know

K'Rgds
Anand
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9612143
oops hart - sorry hadnt refreshed my page ...  !
0
 

Author Comment

by:bradderick
ID: 9612165
Thanks Hart and LOL @ Anand :)
0
 
LVL 11

Expert Comment

by:hart
ID: 9612172
:-)

Regards
Hart
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9612192
:)
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

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…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…

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