scripter73
Programmer
Hi,
I have a query that returns a date to me as a text field in the format "yyyymmdd". It isn't in the date format.
However, I need to do a date compare (based on user selected dates) that are in the format "mm/dd/yyyy".
What I'd like to do is a Query1 that returns the normal database data, and then do a Query2 that updates that date field into the correct format. That way, I can use Query2 to pull accurate records based on a date compare.
I can't update the database, because other people need the date in that format (running AS/400 database).
Can I do this? I think I'm in the right direction with a query within a query, but I'm not sure. My logic in my SQL is a little messed up though.
Here's my code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Date Compare</title>
</head>
<body>
Get AS/400 dates and compare with form dates.
<cfquery name="Query1" datasource="#dsource#">
select last_name,
first_name,
middle_initial,
tran_date
from PLWEBACH
</cfquery>
<!--- loop starts here ---->
<CFLOOP QUERY="Query1">
<CFQUERY NAME="Query2" DATASOURCE="#dsource#">
<cfset achmonth = Mid(tran_date,1,4)>
<cfset achday = Mid(tran_date,5,2)>
<cfset achyear = Mid(tran_date,7,2)>
SELECT last_name, first_name, middle_initial, tran_date
FROM ??PLWEBACH
WHERE
????? I want to update the wach_tran_date to a format #achmonth#/#achday#/#achyear#.
<CFOUTPUT QUERY="Query2">
#last_name#<br>
#first_name#<br>
#middle_initial#<br>
.....updated date here.....<br>
</CFOUTPUT>
</CFLOOP>
<!--- loop ends here --->
</body>
</html>
Any help you can provide is greatly appreciated.
Thanks,
scripter73
Change Your Thinking, Change Your Life.
I have a query that returns a date to me as a text field in the format "yyyymmdd". It isn't in the date format.
However, I need to do a date compare (based on user selected dates) that are in the format "mm/dd/yyyy".
What I'd like to do is a Query1 that returns the normal database data, and then do a Query2 that updates that date field into the correct format. That way, I can use Query2 to pull accurate records based on a date compare.
I can't update the database, because other people need the date in that format (running AS/400 database).
Can I do this? I think I'm in the right direction with a query within a query, but I'm not sure. My logic in my SQL is a little messed up though.
Here's my code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Date Compare</title>
</head>
<body>
Get AS/400 dates and compare with form dates.
<cfquery name="Query1" datasource="#dsource#">
select last_name,
first_name,
middle_initial,
tran_date
from PLWEBACH
</cfquery>
<!--- loop starts here ---->
<CFLOOP QUERY="Query1">
<CFQUERY NAME="Query2" DATASOURCE="#dsource#">
<cfset achmonth = Mid(tran_date,1,4)>
<cfset achday = Mid(tran_date,5,2)>
<cfset achyear = Mid(tran_date,7,2)>
SELECT last_name, first_name, middle_initial, tran_date
FROM ??PLWEBACH
WHERE
????? I want to update the wach_tran_date to a format #achmonth#/#achday#/#achyear#.
<CFOUTPUT QUERY="Query2">
#last_name#<br>
#first_name#<br>
#middle_initial#<br>
.....updated date here.....<br>
</CFOUTPUT>
</CFLOOP>
<!--- loop ends here --->
</body>
</html>
Any help you can provide is greatly appreciated.
Thanks,
scripter73
Change Your Thinking, Change Your Life.