Solved

Posted "today,yesterday, n days ago"

Posted on 2006-10-19
2
248 Views
Last Modified: 2013-12-24
For my crmercado.com site, I show the date posted - boring.

I would like to emphasise that my site is posting 2-3 times daily..

How can I take the date value and display it as follows:

If DatePosted "day" is equal to Now()= "Today"
1 day ago = "Yesterday"
2+ = "N days ago"
0
Comment
Question by:mcsolas
2 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 17769614

 <cfset variables.number_of_days = dateDiff("d",  variables.PostedDate,  now())>

 <cfswitch expression="#variables.number_of_days#">
    <cfcase value="0"> Today</cfcase>
    <cfcase value="1"> Yesterday </cfcase>
    <cfdefaultcase> #variables.number_of_days# days ago</cfdefaultcase>
 </cfswitch>
0
 
LVL 1

Author Comment

by:mcsolas
ID: 17769799
exactly what I needed
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now