What does SNO47E8 mean?
What does this serial number mean?
The prefix SNO is my shorter nickname (snomiao or Snowstar, whatever)
And the number 47E8 is an UNIX DATE.
For easy understanding, you can convert it from hexadecimal to decimal, and you can find that 0x47E8 is equal to 18408.
It's represent the exact time that you will call it "Tue May 26 2020 08:00:00" in Beijing time.
Why? You can count the days from Jan 01 1970 to this day, as the list below
Jan 01 1970
Jan 02 1970
Jan 03 1970
Jan 04 1970
- ... and on and on until ...
May 26 2020
and you can get the count 18408 in decimal, and it's hexadecimal number is 0x47E8.
const sno_sn_generate = (date = undefined, prefix = 'SNO') => prefix + (+new Date(date) / 86400e3 | 0).toString(16).toUpperCase() sno_sn_generate(`May 26 2020 Z`) // output: SNO47E8
May 26 2020 Z means use
UTC+0 time, to ignore the influences from your time zone.
var date = `May 26 2020 Z` // Get the Date's unix timestamp in milliseconds var timestamp = +new Date(date) console.log( timestamp ) // output: 1590451200000 // Cuz you have 60 * 60 * 24 = 86400 seconds in one day, then let timestamp integral divide by it, you can get a date stamp. var datestamp = timestamp / 86400e3 | 0 console.log( datestamp ) // output: 18408 // finally, transfrom this into hexadecimal, and you'll get the number part of SN. var sn = datestamp.toString(16).toUpperCase() console.log(sn) // output: 47E8
You can make the SN number by your self within do a little change on the PREFIX or use other base system or counting method.
As a example I changed the prefix to
hezii，and used base 36 to parse the number, that means the
10 is the next number of
0 ... z.
var date = `May 26 2020 Z` console.log('hezii-' + (+new Date(date) / 86400e3 | 0).toString(36)) // output: hezii-e7c