Groups > Superbase > Superbase NG > BUG or I don't know what I'm doing?




BUG or I don't know what I'm doing?

BUG or I don't know what I'm doing?
Thu, 13 Dec 2007 10:58:32 -050
Note the difference between
SDate and SDate2 in the function FormatDate() pasted below.

E.g. if dtField was Decemeber 12, 2007 (or 733021)

sDate =  Dec 12 2007
sDate2 =  Dec 12, 2007

The comma in SDateFormat seems to be ignored.

On a related note, "" is used for new line, but I must
confess my ignorance of its orgins.  Is it Unicode?

Is there a similar string using {} to designate a comma
I thought "" but that gave me a question mark when I used it 
within sDate2. (How appropriate) and was just ignored or didn't quit 
work when I tried to use it within sDateFormat.

EG.

sDateFormat = "mmm 0dyyyy"   gives you a square
sDateFormat = "mmm 0d yyyy"  does not show a square but behaves
like
sDateFormat = "mmm 0d, yyyy"

OK after trying every combination

SDateFormat = "mmm 0d,yyyy"  gives you a comma AND a Space

which what I want but would not have expected:  "Dec 12, 2007"
but

sDateFormat = "mmm0d,yyyy"

"Dec12, 2007"


I'm trying to recreate the JDKTUTORIAL by myself as an exercise:
Attached is what I have so far.


function FormatDate(string sDate, date dtField)

   string sDays, sMonths, sMonAbbrevs, sDateFormat, sDate2
   integer Month
   SBLlocaledateinfo datelocale

   sDays = "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday"
   sMonths = 
"January,February,March,April,May,June,July,August,September,October,Novemb
er,December"

   sMonAbbrevs = "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec"
   sDateFormat = "mmm 0d, yyyy"

   datelocale =@ SBLlocaledateinfo.new(sDaynames=sDays, 
sMonthnames=sMonths, sMonthsAbbrev=sMonAbbrevs, centurybase=1930, 
format="0m0dyyyy")

   sDate = DATESTR(dtField,sDateFormat,datelocale)
   sDate2 = .lstr(MONTHSTR(dtField,datelocale),3) + 
.tostr((dtField.dayinmonth()),10) + ", " + .tostr(YEAR(dtField),10)

end function
Post Reply
about | contact