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!

Extra Space in "Day" of Crystal "ToText" to Date Format Function (CR 2008)

Status
Not open for further replies.

starkley

IS-IT--Management
Aug 8, 2013
4
0
0
US
thread767-1352528

As in the post previously referenced, I noticed an extra space before the day when formatting using the following:

(ToText(Today + {WorkOrders.shelf_life},('M/d/yy')))

This gives me a result of "12/ 6/13" when I am expecting "12/6/13"


Has anyone found a resolution to this? I too think it's a bug, so I have this ugly workaround:

ToText(Month(Today + {WorkOrders.shelf_life}),0,'') & '/' & ToText(Day(Today + {WorkOrders.shelf_life}),0,'') & '/' & Right(ToText(Year(Today + {WorkOrders.shelf_life}),0,''),2)


Better ideas?
 
The simplest way to get rid of the space would be to use the Replace function, eg

Code:
ReReplace(ToText(Today + {WorkOrders.shelf_life},'M/d/yy'), " ", "")

Pete
 
Fantastic, that works!

Great, simple, elegant solution to an obvious bug.

(Fixed the syntax by removing extra "Re"):

Replace(ToText(Today + {WorkOrders.shelf_life},'M/d/yy'), " ", "")
 
I must have developed stutter! Or just not very good at "Copy and Paste".

Glad it helped.

Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top