Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 446
  • Last Modified:

YYYYMMDD conversion to MM/DD/YY

Please see the ColdFusion code below.  The data in CStart and CEnd is coming as a number in the form of YYYYMMDD.  Is there an easy way to change this to MM/DD/YY.  thx

<cfquery name="campaign_dates" datasource="Pluto" dbtype="ODBC">
SELECT     NAM_ORG_1001000_NAME1 AS Name, ADT_ORG_EFFECTIVEDATE_CAMPDATES AS CStart, ADT_ORG_EXPIRYDATE_CAMPDATES AS CEnd
FROM         dbo.DATAEXTRACTANDARCAMPAIGNDATESDMO1
</cfquery>

<cfheader name="Content-Disposition" value="inline;filename=CampaignDates.xls">
<cfcontent type="application/msexcel">

<table border="1" cellspacing="1">
  <thead>
    <tr>
      <td>Name</td>
      <td>CStart</td>
      <td>CEnd</td>
        </tr>
  </thead>
  <tbody>
    <cfoutput query="campaign_dates">
      <tr>
        <td>#Name#</td>
        <td>#CStart#</td>
        <td>#CEnd#</td>
      </tr>
    </cfoutput>
  </tbody>
</table>
0
ssdanish
Asked:
ssdanish
1 Solution
 
_agx_Commented:
One way is to use string functions

...
<td>#mid(CStart, 5, 2)#/#right(CStart, 2)#/#mid(CStart, 3, 2)#</td>
<td>#mid(CEnd, 5, 2)#/#right(CEnd, 2)#/#mid(CEnd, 3, 2)#</td>
...

If its something you'll do often, consider putting the logic into a custom function.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now