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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

type conversion 1

Status
Not open for further replies.

mirogak

Programmer
Sep 28, 2006
65
US
Hi there,

Using CR 11.5

Have a really simple question to ask that I can't solve.

In a formula, I try to get the year of current date like this:

year(currentdate)

it returns 2,010.00

I need to turn this whole number into text using cstr but when I do that, I get "2,011.00"

How can I get rid of the decimal and the comma? I can get rid of the decimal places but not the comma.

Help.

Thanks,
mirogak
 

In your first example the result is a number, so you can right click --> Format Field and format it as you would any numeric field.

That is probably preferable to a text value, but if you want text you could go with:

totext(year(currentdate),"#",0)

Search for 'format strings' in CR help to see the various options for formatting converted values.

 
Or you could use:

totext(year(currentdate),"0000") //four zeros for four digits

Or,

totext(year(currentdate),0,"") //0 for no decimals, "" for no comma delimiter

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top