Do you have a better solution how to convert today's dates to Stardate? Is there any agreed on (by fans, anyways) standard that I simply missed?

https://doughnut.neocities.org/blag/19

Captain's log, stardate -2977420.6

@bugbear

Oooh, neat question! I remember pondering this when I was a teenager in the 90s.
I actually realized early on that the standard ISO date format is the best: YYYY-MM-DD (although I didn't use hyphens at the time, as stardates don't have hyphens), and started using YYYYMMDD for my digital diary way back then (long lost, sadly, or maybe not SO sadly, if you knew me as a teenager, lol)

But the canonical system of #Stardate as of the TNG era was 40000 + 1000 * season_number + "day", where the "day" was something like (day_of_year / 365 * 999)

So, since season 1 was 1987, the "current" stardate would be something like 2025-1987 + 41 = 79000

As far as the non-sequential order of TOS stardates goes, this is because NBC did not air the episode in the order they were made. They were produced sequentially, but not aired sequentially.

The other problem is that the stardates are tied to the beginning of TNG seasons (in the fall), and not the beginning of calendar years. That makes things more difficult, but I guess the best solution would be to use the number of days since Encounter at Farpoint aired? (1987-09-28)

Here's what I came up with using bash, bc (which you may need to install) and awk:

$ echo "( $(date +%s) - $(date +%s -d 1987-09-28) ) / 365.25 / 24 / 3600 * 1000 + 41000" |bc -l |awk '{printf "%.1f\n", $1}' 78967.2

@amin

@rl_dane @bugbear @amin I just have to give props here for the use of bc and awk. I feel young again :).

@nazgul @bugbear @amin

This is the way!

@rl_dane @nazgul @amin @bugbear drop the -l though unless you actually need to load the math library

(I use bc lots…)

@mirabilos @nazgul @amin @bugbear

How do you set the decimal precision without -l? I'm a total noob.

@rl_dane @nazgul @amin @bugbear -l just loads the library (for sinus, etc). You need set the scale, even if you load the library.

RTFM bc(1), dc(1), 06.bc(USD), 05.dc(USD)

RTFM bc(1)

RTFM

xkcd
@amin @rl_dane @nazgul @bugbear I was just teaching him to fish, with good quality reference material (not the GNU nincompoop)

@mirabilos @rl_dane @nazgul @bugbear

Yeah, I just couldn't resist the reference; I don't get to cite that one often. ;)