雪星实验室

What does SNO47E8 mean?

Answer to Ask

#SNO47E8

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

  • 0 is Jan 01 1970
  • 1 is Jan 02 1970
  • 2 is Jan 03 1970
  • 3 is Jan 04 1970
  • ... and on and on until ...
  • 18408 is 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

Tips: the Z of May 26 2020 Z means use UTC+0 time, to ignore the influences from your time zone.

Let's parse this code

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

Extended

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

Reference:


Snowstar Miao
Snowstar Miao.