Print Page | Close Window

Formating a date field

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=19745
Printed Date: 01 May 2024 at 6:48pm


Topic: Formating a date field
Posted By: bremen
Subject: Formating a date field
Date Posted: 08 Jul 2013 at 2:20am
I am creating a report to show if a purchased part has been received.  I would like to have the letter "TBD" to show if the item hasnt been recieved other wise show the date it was received. 
 
what I have in there now is
 
if isnull ({Table.field})
then
"TBD"
else
totext ({Table.field})
 
With this formula I am unable to then format the the way the date is displayed? 
 
im sure there is a different formula to accomplish this, but I do not know what operators to use. 



Replies:
Posted By: DBlank
Date Posted: 08 Jul 2013 at 3:50am
in the totext(date) you can include formatting options
 
e.g. totext(table.date,"M/d/yy")
 
from crystal help here are the options
Character Comments

d

day of month without leading zero for single digits

dd

day of month with leading zero for single digits.

ddd

day of week as a three letter abbreviation

dddd

full name of day of week

M

month without leading zero for single digit

MM

month with leading zero for single digit

MMM

month as three letter abbreviation.

MMMM

full name of month

yy

last two digits of year

yyyy

full four digits of year

h

hours without leading zeros for single digits (12 hour)

hh

hours without leading zeros for single digits (12 hour).

H

hours without leading zeros for single digits (24 hour)

HH

hours with leading zeros for single digits (24 hour)

m

minutes without leading zeros for single digits

mm

minutes with leading zeros for single digits

s

seconds without leading zeros for single digits

ss

seconds with leading zeros for single digits

t, tt

single character or multiple character a.m./p.m. string

 
 


Posted By: bremen
Date Posted: 08 Jul 2013 at 4:08am

Thank you.

 
that did it



Print Page | Close Window