static int userDateSequence()
{
int ds1, ds2, ds3;
date d = str2Date('2015/12/18', 321);
str s = strFmt('%1', d);
void datepart(str strDate, str dval, int part)
{
if (strEndsWith(strDate, dval))
ds3 = part;
else if (strStartsWith(strDate, dval))
ds1 = part;
else
ds2 = part;
}
datepart(s, '18', 1);
datepart(s, '12', 2);
datepart(s, '2015', 3);
return ds1 * 100 + ds2 * 10 + ds3;
}
No comments:
Post a Comment