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
LVL 7
sr_millarAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongCommented:
You may need to try the DateFormat Fuction, like:

<cfset todayDate = Now()>
<body>
<h3>DateFormat Example</h3>
<p>Today's date is <cfoutput>#todayDate#</cfoutput>.
<p>Using DateFormat, we can display that date in different ways:
<cfoutput>
<ul>
  <li>#DateFormat(todayDate)#
  <li>#DateFormat(todayDate, "mmm-dd-yyyy")#
  <li>#DateFormat(todayDate, "mmmm d, yyyy")#
  <li>#DateFormat(todayDate, "mm/dd/yyyy")#
  <li>#DateFormat(todayDate, "dd/mm/yyyy")#
  <li>#DateFormat(todayDate, "d-mmm-yyyy")#  
  <li>#DateFormat(todayDate, "ddd, mmmm dd, yyyy")#  
  <li>#DateFormat(todayDate, "d/m/yy")#
</ul>  
</cfoutput>

cheers
0
sr_millarAuthor Commented:
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=GetFileFromPath(GetTemplatePath())>
<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)*MaxRows_All+1,Max(All.RecordCount,1))>
<cfset EndRow_All=Min(StartRow_All+MaxRows_All-1,All.RecordCount)>
<cfset TotalPages_All=Ceiling(All.RecordCount/MaxRows_All)>
<cfset QueryString_All=Iif(CGI.QUERY_STRING NEQ "",DE("&"&XMLFormat(CGI.QUERY_STRING)),DE(""))>
<cfset tempPos=ListContainsNoCase(QueryString_All,"PageNum_All=","&")>
<cfif tempPos NEQ 0>
  <cfset QueryString_All=ListDeleteAt(QueryString_All,tempPos,"&")>
</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?recordID=#All.BusinessUnit#">#All.BusinessUnit# </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#?PageNum_All=1#QueryString_All#">First</a>
        </cfif>
      </td>
      <td width="31%" align="center"><cfif PageNum_All GT 1>
          <a href="#CurrentPage#?PageNum_All=#Max(DecrementValue(PageNum_All),1)##QueryString_All#">Previous</a>
        </cfif>
      </td>
      <td width="23%" align="center"><cfif PageNum_All LT TotalPages_All>
          <a href="#CurrentPage#?PageNum_All=#Min(IncrementValue(PageNum_All),TotalPages_All)##QueryString_All#">Next</a>
        </cfif>
      </td>
      <td width="23%" align="center"><cfif PageNum_All LT TotalPages_All>
          <a href="#CurrentPage#?PageNum_All=#TotalPages_All##QueryString_All#">Last</a>
        </cfif>
      </td>
    </tr>
  </cfoutput>
</table>
<cfoutput>Records #StartRow_All# to #EndRow_All# of #All.RecordCount# </cfoutput>
</body>
</html>
0
Ryan ChongCommented:
i guess you need to format the value for column "QuoteDate" , right? try this:

<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<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)*MaxRows_All+1,Max(All.RecordCount,1))>
<cfset EndRow_All=Min(StartRow_All+MaxRows_All-1,All.RecordCount)>
<cfset TotalPages_All=Ceiling(All.RecordCount/MaxRows_All)>
<cfset QueryString_All=Iif(CGI.QUERY_STRING NEQ "",DE("&"&XMLFormat(CGI.QUERY_STRING)),DE(""))>
<cfset tempPos=ListContainsNoCase(QueryString_All,"PageNum_All=","&")>
<cfif tempPos NEQ 0>
  <cfset QueryString_All=ListDeleteAt(QueryString_All,tempPos,"&")>
</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?recordID=#All.BusinessUnit#">#All.BusinessUnit# </a></td>
      <td>#All.QuoteNo# </td>
      <td>#All.MonthYear# </td>
      <td>#DateFormat(All.QuoteDate, "dd/mm/yyyy")# </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#?PageNum_All=1#QueryString_All#">First</a>
        </cfif>
      </td>
      <td width="31%" align="center"><cfif PageNum_All GT 1>
          <a href="#CurrentPage#?PageNum_All=#Max(DecrementValue(PageNum_All),1)##QueryString_All#">Previous</a>
        </cfif>
      </td>
      <td width="23%" align="center"><cfif PageNum_All LT TotalPages_All>
          <a href="#CurrentPage#?PageNum_All=#Min(IncrementValue(PageNum_All),TotalPages_All)##QueryString_All#">Next</a>
        </cfif>
      </td>
      <td width="23%" align="center"><cfif PageNum_All LT TotalPages_All>
          <a href="#CurrentPage#?PageNum_All=#TotalPages_All##QueryString_All#">Last</a>
        </cfif>
      </td>
    </tr>
  </cfoutput>
</table>
<cfoutput>Records #StartRow_All# to #EndRow_All# of #All.RecordCount# </cfoutput>
</body>
</html>

that's basically replace:

#All.QuoteDate#

to:

#DateFormat(All.QuoteDate, "dd/mm/yyyy")#

Apply this to your other columns if you want to format it with DateFormat function, cheers
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sr_millarAuthor Commented:
Spot on, worked first time - many thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Dreamweaver

From novice to tech pro — start learning today.