Solved

Coverting ODBC DateTime back to coldfusion DateTime

Posted on 2003-10-23
9
308 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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 …
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

770 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