Solved

Function to format date part of variable

Posted on 2006-07-13
4
1,146 Views
Last Modified: 2007-11-27
I have a formula field that displays the date range based on two other date formula fields. The formula is:
{@StartDate} & " through " & {@StopDate}

The problem is, it displays as (example):
7/12/2006 08:12:34 through 8/11/2006 08:12:34

I want it to display as:
7/12/2006 through 8/11/2006

Other than using DatePart to pull each of the parts of the date and concatenating them back together, is there another function I can use?
0
Comment
Question by:dbbishop
  • 2
4 Comments
 
LVL 42

Accepted Solution

by:
frodoman earned 300 total points
ID: 17102101
CStr({@StartDate},'MM/dd/yyyy') + ' through ' + CStr({@StopDate},'MM/dd/yyyy')

Make sure you use upper case M or you'll get 'minutes' instead of 'months'
0
 
LVL 28

Assisted Solution

by:bdreed35
bdreed35 earned 200 total points
ID: 17103046
I would just add that if you only want a single digit month value or day value then you can alter it this way:

CStr({@StartDate},'M/d/yyyy') + ' through ' + CStr({@StopDate},'M/d/yyyy')

I am just going based upon your example data that you posted
0
 
LVL 15

Author Comment

by:dbbishop
ID: 17104857
Thanks to both of you. For some reason, when I hit F1 in in the Formula Workshop I get an error telling me Help is not installed. I've looked through the noprmal Crystal help and the Developer's help manual and could find nothing that would help me (I am used to using Format in VB)
0
 
LVL 42

Expert Comment

by:frodoman
ID: 17107747
You might want to try a reinstall to get your help files - they're actually worthwhile in Crystal and there is a topic that fully explains all of the date format options.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 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