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

Removing Characters From A String

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
lcDate = CTOD(DATE())

Which of course stores today's date (03/21/02) to the variable. Is there anyway (or way is the easiest excuse me, most efficient way) to remove the "/" from the date and only return 032102.

Thanks
 
Try

Code:
STRTRAN(lcdate, "/", "")
Dave Dardinger
 
Of course, DTOS() is great -- returns in CCYYMMDD format, no dots, hyphens, slashes, and no date ambiguity.

DTOS(date()) will return 20020321 today. Always has 4 characters for year, 2 for month and two for day, great for string manipulation.

Need day as string?
SUBSTR(DTOS(date()),7,2) always provides it, whether it's the first day of month or last!

Substitute any date, or variable, for date() - and you have a powerful, consistent starting point for date as string manipulation.
 
HI
lcDate = DTOS(DATE()) is the way to go :)

ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
set century off
lcDate = chrtran(dtoc(date()),"/","")

this will eliminate the the "20" in the year portion of the date. Then the chrtran() function will get rid of the forward slash. Usually the third parameter in the chrtran() function is used to replace all the characters in the string which is the first parameter that matches the second parameter, but if you use empty quotes it will just erase those characters.

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top