Solved

Posted "today,yesterday, n days ago"

Posted on 2006-10-19
2
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
What You Need to Know when Searching for a Webhost Provider
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

623 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