c**t 发帖数: 2744 | 1 how to use three characters to represent a date? |
c**t 发帖数: 2744 | 2 MM - 0-9AB
DD - 0-9A-U
YY - chr(33) - chr(133)?
【在 c**t 的大作中提到】 : how to use three characters to represent a date?
|
D****g 发帖数: 2860 | 3 没明白
【在 c**t 的大作中提到】 : how to use three characters to represent a date?
|
c**t 发帖数: 2744 | 4 It's easy to use one character to reprent either month or day; The maximun
one
is 31. (we have 0-9A-Z total 36 to use); but for year, assuming using two
digits, there are 100 possibilities, may use ascii to reprent....
Is there better idea to encode a date?
【在 D****g 的大作中提到】 : 没明白
|
t****t 发帖数: 6806 | 5 要只用0-9A-Z也不是不可以,不过就要做一点运算而已
100*12*31=37200 < 46656=36*36*36
【在 c**t 的大作中提到】 : It's easy to use one character to reprent either month or day; The maximun : one : is 31. (we have 0-9A-Z total 36 to use); but for year, assuming using two : digits, there are 100 possibilities, may use ascii to reprent.... : Is there better idea to encode a date?
|
c**t 发帖数: 2744 | 6 gotta, 36 进制! 我也是才想到这一点
【在 t****t 的大作中提到】 : 要只用0-9A-Z也不是不可以,不过就要做一点运算而已 : 100*12*31=37200 < 46656=36*36*36
|
c**t 发帖数: 2744 | 7 这样三位可以cover 127 年
【在 c**t 的大作中提到】 : gotta, 36 进制! 我也是才想到这一点
|
t****t 发帖数: 6806 | 8 那你干嘛不用0-9A-Za-z,就可以cover 640年了
【在 c**t 的大作中提到】 : 这样三位可以cover 127 年
|
c**t 发帖数: 2744 | 9 the tag requires upper case & digits only
【在 t****t 的大作中提到】 : 那你干嘛不用0-9A-Za-z,就可以cover 640年了
|
O*******d 发帖数: 20343 | 10 Using first 4 bits of the first char to represent month 1 - 12. The last 4
bits to represent day 1-16. Using one bit in the second char to represent a
flag which indicates whether to add 15 to the day. You will then have 15
remaining bit to represent year that will be from 0 to 32767. |
g*****g 发帖数: 34805 | 11 Use a number of offset by 1900-1-1 for example.
You have 24 bits, that's more than enough.
Actually time is done that way internally in Unix.
【在 c**t 的大作中提到】 : how to use three characters to represent a date?
|
c**t 发帖数: 2744 | 12 I used the offset (days) by 2000-1-1 and 35 base. There is some limit: shoul
d be always three characters (0-9A-Z).
Actually I don't have 24 bits to use.
【在 g*****g 的大作中提到】 : Use a number of offset by 1900-1-1 for example. : You have 24 bits, that's more than enough. : Actually time is done that way internally in Unix.
|
g*****g 发帖数: 34805 | 13 If you can't take full advantage of the bits, yes, you can only
cover 36*36*36 and approximately 127 years then.
shoul
【在 c**t 的大作中提到】 : I used the offset (days) by 2000-1-1 and 35 base. There is some limit: shoul : d be always three characters (0-9A-Z). : Actually I don't have 24 bits to use.
|