Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 929995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:15:52+00:00 2026-05-15T20:15:52+00:00

for example we have date May 12, 2010 <cfset may_12_2010 = CreateDate(2010, 5, 12)>

  • 0

for example we have date May 12, 2010

<cfset may_12_2010 = CreateDate(2010, 5, 12)>

using DateFormat function, we can use

DateFormat(may_12_2010, "mmmm m dddd d yyyy")

which will show May 5 Wednesday 12 2010

if for some reason I can’t use the DateFormat function, how we can show the same results (with the same mask) with the above example?

code:

<cfset may_12_2010 = CreateDate(2010, 5, 12)>

<cfset mask = "mmmm m dddd d yyyy">

#DateFormat(may_12_2010, mask)#

<cfset d = DateFormat(may_12_2010, "d") />
<cfset dd = DateFormat(may_12_2010, "dd") />
<cfset ddd = DateFormat(may_12_2010, "ddd") />
<cfset dddd = DateFormat(may_12_2010, "dddd") />

<cfset m = DateFormat(may_12_2010, "m") />
<cfset mm = DateFormat(may_12_2010, "mm") />
<cfset mmm = DateFormat(may_12_2010, "mmm") />
<cfset mmmm = DateFormat(may_12_2010, "mmmm") />

<cfset yy = DateFormat(may_12_2010, "yy") />
<cfset yyyy = DateFormat(may_12_2010, "yyyy") />

<cfset stringDate = mask />

<cfset stringDate = REReplaceNoCase(stringDate, "d{4,4}", dddd, "ALL") />
<cfset stringDate = REReplaceNoCase(stringDate, "d{3,3}", ddd, "ALL") />
<cfset stringDate = REReplaceNoCase(stringDate, "d{2,2}", dd, "ALL") />
<cfset stringDate = REReplaceNoCase(stringDate, "d", d, "ALL") />

<cfset stringDate = REReplaceNoCase(stringDate, "m{4,4}", mmmm, "ALL") />
<cfset stringDate = REReplaceNoCase(stringDate, "m{3,3}", mmm, "ALL") />
<cfset stringDate = REReplaceNoCase(stringDate, "m{2,2}", mm, "ALL") />
<cfset stringDate = REReplaceNoCase(stringDate, "m", m, "ALL") />

<cfset stringDate = REReplaceNoCase(stringDate, "y{4,4}", yyyy, "ALL") />
<cfset stringDate = REReplaceNoCase(stringDate, "y{2,2}", yy, "ALL") />

<br>
#stringDate#

the code above will show

May 5 Wednesday 12 2010
5ay 5 We12nes12ay 12 2010

thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:15:53+00:00Added an answer on May 15, 2026 at 8:15 pm

    To solve your problem, simply make your regexes:

    <cfset stringDate = REReplaceNoCase(stringDate, "\bdddd\b" , dddd , "ALL") />
    <cfset stringDate = REReplaceNoCase(stringDate, "\bddd\b"  , ddd  , "ALL") />
    <cfset stringDate = REReplaceNoCase(stringDate, "\bdd\b"   , dd   , "ALL") />
    <cfset stringDate = REReplaceNoCase(stringDate, "\bd\b"    , d    , "ALL") />
    ....
    

    Where the \b marks the position of a “word boundary” — which is a change between a word character and non-word character, where a “word character” is [a-zA-Z0-9_] — and so prevents the d’s in “wednesday” from matching.

    But really, just use the DateFormat function properly!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an example function below that reads in a date as a string
I have created a CPTTradingRangePlot using the up-to-date sample code as an example. The
How to sort list of date object ? For example I have unsorted list
i want to format date to string in hql select, for example i have
I am working on Java. I have a date for example: 20120328. Year is
I have an Oracle DATE column with, for example, these values: RUN_DATE ------------------- 2012-06-09
Does anyone have any example on how to put a date time picker inside
I have a function that parses a string containing a date(and/or time) e.g. 2009-12-10
I have a table that has several date fields. For example, in the defects
I'm using the JQuery DatePicker to have the user pick a date and have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.