Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

racking my brain

Status
Not open for further replies.

Bocurry

Technical User
Aug 27, 2001
6
US
Hey All,

I'm a newbie as you'll be able to tell. I know there is any easy way to do this but can figure it out.

I need to show the day of week as the word, eg.. Mon, Teus, etc...

so I'm first converting it to a number with the dayofweek formula. But how do I translate that into text. I'm trying "if then else", but to no avail.

if @dow = 1 then "Sat" ; if @dow = 2 then "mon" ... else = "Sun"

Any help is much appreciated!
 
Hi, If it is from a Date field, use the ToText function:

ToText({date},'ddd')
will give Mon, Tue, etc..
toText({date},'dddd') gives
Monday, Tuesday, etc...

[profile]
 
Create a formula:
@day

DayOfWeek ({tablename.datefieldname})

Create a second formula:
@dayofweek

select {@day}
case 1 : "Mon"
case 2 : "Mon"
case 3 : "Tue"
case 4 : "Wed"
case 5 : "Thu"
case 6 : "Fri"
case 7 : "Sat"
default : " "
 
Thanks mcoleman!

"case" that words in conjuring up nightmares from my C+ class, ughh
 
In version 8.5 and above you can use the
"WeekdayName" function.
So you could use

WeekdayName (@dow)

which would return the day name in full or you could use

WeekdayName (@dow, true)

which would retuen a 3-character abbreviation of the day (ie Mon, Tue, Wed). The "true" in the formula above is to show that the name is to be abbreviated. See the help file for more details.

HTH,

John
 
Dear Bocurry,

You could just right click on the date field and choose Format Field and customize the display of the date to show only the name of the day .. no formula required.

regards,

ro

Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top