sr_millar
asked on
UK Date Format in DW
Hi,
I have setup a site which a page which displays data from an Access database. I have saved the page as all.cfm (i have coldfusion running on the server) and when I view the date column on the page it displays 2005-03-10 00:00:00 for example. How can I make it display 10/03/2005 (dd/mm/yyyy)
Any help would be great.
Stuart
I have setup a site which a page which displays data from an Access database. I have saved the page as all.cfm (i have coldfusion running on the server) and when I view the date column on the page it displays 2005-03-10 00:00:00 for example. How can I make it display 10/03/2005 (dd/mm/yyyy)
Any help would be great.
Stuart
ASKER
Hi,
Thanks for answering:
Here is the code for my page,as you can see the date is put in the table by DW - I used the application object option to insert the dbase results. Can you tell me how I amend my code with your function to disply the date column as dd/mm/yyyy?
<cfset CurrentPage=GetFileFromPat h(GetTempl atePath()) >
<cfparam name="PageNum_All" default="1">
<cfquery name="All" datasource="QTS">
SELECT BusinessUnit, QuoteNo, MonthYear, QuoteDate, Company, Existing, ContPerson, Description, EquipCode, EndUseLoc, Status, IfLostTo, Comments, DayRateCurr, DayRateSter, PriceBook, DiscountRate, LongTermCalc, Period36912, Basis146198, Commission, CommisonRate, Agent, Probability
FROM Results
ORDER BY QuoteDate DESC
</cfquery>
<cfset MaxRows_All=10>
<cfset StartRow_All=Min((PageNum_ All-1)*Max Rows_All+1 ,Max(All.R ecordCount ,1))>
<cfset EndRow_All=Min(StartRow_Al l+MaxRows_ All-1,All. RecordCoun t)>
<cfset TotalPages_All=Ceiling(All .RecordCou nt/MaxRows _All)>
<cfset QueryString_All=Iif(CGI.QU ERY_STRING NEQ "",DE("&"&XMLFormat(CGI.QU ERY_STRING )),DE("")) >
<cfset tempPos=ListContainsNoCase (QueryStri ng_All,"Pa geNum_All= ","&")>
<cfif tempPos NEQ 0>
<cfset QueryString_All=ListDelete At(QuerySt ring_All,t empPos,"&" )>
</cfif>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<table border="1" align="center">
<tr>
<td>BusinessUnit</td>
<td>QuoteNo</td>
<td>MonthYear</td>
<td>QuoteDate</td>
<td>Company</td>
<td>Existing</td>
<td>ContPerson</td>
<td>Description</td>
<td>EquipCode</td>
<td>EndUseLoc</td>
<td>Status</td>
<td>IfLostTo</td>
<td>Comments</td>
<td>DayRateCurr</td>
<td>DayRateSter</td>
<td>PriceBook</td>
<td>DiscountRate</td>
<td>LongTermCalc</td>
<td>Period36912</td>
<td>Basis146198</td>
<td>Commission</td>
<td>CommisonRate</td>
<td>Agent</td>
<td>Probability</td>
</tr>
<cfoutput query="All" startRow="#StartRow_All#" maxRows="#MaxRows_All#">
<tr>
<td><a href="allquotes.cfm?record ID=#All.Bu sinessUnit #">#All.Bu sinessUnit # </a></td>
<td>#All.QuoteNo# </td>
<td>#All.MonthYear# </td>
<td>#All.QuoteDate# </td>
<td>#All.Company# </td>
<td>#All.Existing# </td>
<td>#All.ContPerson# </td>
<td>#All.Description# </td>
<td>#All.EquipCode# </td>
<td>#All.EndUseLoc# </td>
<td>#All.Status# </td>
<td>#All.IfLostTo# </td>
<td>#All.Comments# </td>
<td>#All.DayRateCurr# </td>
<td>#All.DayRateSter# </td>
<td>#All.PriceBook# </td>
<td>#All.DiscountRate# </td>
<td>#All.LongTermCalc# </td>
<td>#All.Period36912# </td>
<td>#All.Basis146198# </td>
<td>#All.Commission# </td>
<td>#All.CommisonRate# </td>
<td>#All.Agent# </td>
<td>#All.Probability# </td>
</tr>
</cfoutput>
</table>
<br>
<table border="0" width="50%" align="center">
<cfoutput>
<tr>
<td width="23%" align="center"><cfif PageNum_All GT 1>
<a href="#CurrentPage#?PageNu m_All=1#Qu eryString_ All#">Firs t</a>
</cfif>
</td>
<td width="31%" align="center"><cfif PageNum_All GT 1>
<a href="#CurrentPage#?PageNu m_All=#Max (Decrement Value(Page Num_All),1 )##QuerySt ring_All#" >Previous< /a>
</cfif>
</td>
<td width="23%" align="center"><cfif PageNum_All LT TotalPages_All>
<a href="#CurrentPage#?PageNu m_All=#Min (Increment Value(Page Num_All),T otalPages_ All)##Quer yString_Al l#">Next</ a>
</cfif>
</td>
<td width="23%" align="center"><cfif PageNum_All LT TotalPages_All>
<a href="#CurrentPage#?PageNu m_All=#Tot alPages_Al l##QuerySt ring_All#" >Last</a>
</cfif>
</td>
</tr>
</cfoutput>
</table>
<cfoutput>Records #StartRow_All# to #EndRow_All# of #All.RecordCount# </cfoutput>
</body>
</html>
Thanks for answering:
Here is the code for my page,as you can see the date is put in the table by DW - I used the application object option to insert the dbase results. Can you tell me how I amend my code with your function to disply the date column as dd/mm/yyyy?
<cfset CurrentPage=GetFileFromPat
<cfparam name="PageNum_All" default="1">
<cfquery name="All" datasource="QTS">
SELECT BusinessUnit, QuoteNo, MonthYear, QuoteDate, Company, Existing, ContPerson, Description, EquipCode, EndUseLoc, Status, IfLostTo, Comments, DayRateCurr, DayRateSter, PriceBook, DiscountRate, LongTermCalc, Period36912, Basis146198, Commission, CommisonRate, Agent, Probability
FROM Results
ORDER BY QuoteDate DESC
</cfquery>
<cfset MaxRows_All=10>
<cfset StartRow_All=Min((PageNum_
<cfset EndRow_All=Min(StartRow_Al
<cfset TotalPages_All=Ceiling(All
<cfset QueryString_All=Iif(CGI.QU
<cfset tempPos=ListContainsNoCase
<cfif tempPos NEQ 0>
<cfset QueryString_All=ListDelete
</cfif>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<table border="1" align="center">
<tr>
<td>BusinessUnit</td>
<td>QuoteNo</td>
<td>MonthYear</td>
<td>QuoteDate</td>
<td>Company</td>
<td>Existing</td>
<td>ContPerson</td>
<td>Description</td>
<td>EquipCode</td>
<td>EndUseLoc</td>
<td>Status</td>
<td>IfLostTo</td>
<td>Comments</td>
<td>DayRateCurr</td>
<td>DayRateSter</td>
<td>PriceBook</td>
<td>DiscountRate</td>
<td>LongTermCalc</td>
<td>Period36912</td>
<td>Basis146198</td>
<td>Commission</td>
<td>CommisonRate</td>
<td>Agent</td>
<td>Probability</td>
</tr>
<cfoutput query="All" startRow="#StartRow_All#" maxRows="#MaxRows_All#">
<tr>
<td><a href="allquotes.cfm?record
<td>#All.QuoteNo# </td>
<td>#All.MonthYear# </td>
<td>#All.QuoteDate# </td>
<td>#All.Company# </td>
<td>#All.Existing# </td>
<td>#All.ContPerson# </td>
<td>#All.Description# </td>
<td>#All.EquipCode# </td>
<td>#All.EndUseLoc# </td>
<td>#All.Status# </td>
<td>#All.IfLostTo# </td>
<td>#All.Comments# </td>
<td>#All.DayRateCurr# </td>
<td>#All.DayRateSter# </td>
<td>#All.PriceBook# </td>
<td>#All.DiscountRate# </td>
<td>#All.LongTermCalc# </td>
<td>#All.Period36912# </td>
<td>#All.Basis146198# </td>
<td>#All.Commission# </td>
<td>#All.CommisonRate# </td>
<td>#All.Agent# </td>
<td>#All.Probability# </td>
</tr>
</cfoutput>
</table>
<br>
<table border="0" width="50%" align="center">
<cfoutput>
<tr>
<td width="23%" align="center"><cfif PageNum_All GT 1>
<a href="#CurrentPage#?PageNu
</cfif>
</td>
<td width="31%" align="center"><cfif PageNum_All GT 1>
<a href="#CurrentPage#?PageNu
</cfif>
</td>
<td width="23%" align="center"><cfif PageNum_All LT TotalPages_All>
<a href="#CurrentPage#?PageNu
</cfif>
</td>
<td width="23%" align="center"><cfif PageNum_All LT TotalPages_All>
<a href="#CurrentPage#?PageNu
</cfif>
</td>
</tr>
</cfoutput>
</table>
<cfoutput>Records #StartRow_All# to #EndRow_All# of #All.RecordCount# </cfoutput>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Spot on, worked first time - many thanks.
<cfset todayDate = Now()>
<body>
<h3>DateFormat Example</h3>
<p>Today's date is <cfoutput>#todayDate#</cfo
<p>Using DateFormat, we can display that date in different ways:
<cfoutput>
<ul>
<li>#DateFormat(todayDate)
<li>#DateFormat(todayDate,
<li>#DateFormat(todayDate,
<li>#DateFormat(todayDate,
<li>#DateFormat(todayDate,
<li>#DateFormat(todayDate,
<li>#DateFormat(todayDate,
<li>#DateFormat(todayDate,
</ul>
</cfoutput>
cheers