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

Need to trim off the 0 in 09/17/07

Status
Not open for further replies.

wrighterb

Programmer
Feb 20, 2007
80
US


Need to trim off the 0 in 09/17/07 but only if it is a zero

Any Ideas, it will be happening in a loop.

Thanks.
 
trim off the 0 in 09/17/07 " there are two zeros in your example.

To remove leading zero only:
Code:
<cfset mdate='09/17/07'>
<cfif left(mdate,1) eq '0'>
	<cfset mdate=mid(mdate,2,len(mdate)-1)>
</cfif>
To remove all zeros:
Code:
<cfset mdate='09/17/07'>
<cfif find('0',mdate)>
	<cfset mdate=replace(mdate,'0','','ALL')>
</cfif>

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
If its a date/time value you could use dateFormat to skip the leading zero.

#DateFormat(dateValue, "m/dd/yy")#
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top