Solved

Coverting ODBC DateTime back to coldfusion DateTime

Posted on 2003-10-23
9
311 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
Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

 
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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

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…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
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 manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…

752 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