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!

Default thousands separator 1

Status
Not open for further replies.

jobi

Technical User
Jun 30, 2000
24
NO
The System Default Number Format (File - Options - Fields - Number - Number) is with Thousands Separator.
I don't want to change that. (This is different on different computers, too...)

I have a field in SQL Server that stores dates in this format: yyyymmdd.

Because of this System Default Number Format this date is presented this way: yy yym mdd.
Of course, it is simle to format this to yyyymmdd in the field used in the report.

But this is not simple if I want to split this "date" field (yyyymmdd) into 3 different fields (yyyy, mm and dd) using a formula. The formula uses the System Default Number Format.

If i use the Strings Functions, this might work on my computer:
ToText (Left (ToText ({Table.Field}), 2), (Mid (ToText ({Table.Field}), 3, 2)))
This formula excludes the Thousand Separator between the first two y's and the next two.

But when I run this on a computer with other System Default Number Format (for example with no Thousand Separator) nothing works.

How do I split yyyymmdd into yyyy, mm and dd in a simple way, without changing the System Default Number Format, and in a way that works on "all" computers?
 
Try this

//@SplitDate

WhilePrintingRecords;
StringVar TheYear;
StringVar TheMonth;
StringVar TheDay;
StringVar Temp := totext({table.Datenumeric),0,"","");

TheYear := Temp[1 to 4];
TheMonth := Temp[5 to 6];
TheDay := Temp[7 to 8];


You could convert these to numbers if you wanted to.



Jim Broadbent
 
Much easier if you use the NumberToDate() function, which converts an 8 digit integer in a YYYYMMDD format into a real date. You will have to download the NumberToDate() UFL from Crystal Decisions however.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
{shrug} this formula isn't exactly complicated rocket science...and it works fine...now need to hunt for the UFL

Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top