Solved

Coverting ODBC DateTime back to coldfusion DateTime

Posted on 2003-10-23
9
305 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
  • 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php :…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

758 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

20 Experts available now in Live!

Get 1:1 Help Now