From the "Stardates in Star Trek FAQ":
Before the Federation was founded, everyone involved in space travel used their own time system. Terrans used the Gregorian calendar and UTC; Vulcans used their own calendar. Initially the Federation used the Terran calendar, just as it used the Terran language and had its headquarters on Earth. This system proved to be extremely unpopular, especially with the Vulcans, who liked a calendar to have some logic about it. (Alternating 30-day months with 31 is fine, but sticking a 28 in the middle of that lot is just silly.)

A Stardate is a fictional unit of measure applied to the passage of time. Gene Roddenberry's Star Trek series (Original airdate- 1966) originated the measure, according to Roddenberry, to place the series well into the future without a strong reference point the viewers could grasp.

While the "Stardates in Star Trek FAQ" (available at http://www.cs.umanitoba.ca/~djc/startrek/stardates/) goes into what some may consider an extremist dissection of the purpose, origin, and calculation of a Stardate, from both the real-world and Trek-world views, I prefer a simpler view.

The Stardates of the original (Roddenberry) series seemed to be somewhat arbitrarily chosen, to a degree. The dates ranged from 1512 to 5928. While some episodes had a wide variance, according to "Star Trek Chronology", one Stardate appears to have corresponded to one day. However, in some episodes, stardates even jumped backwards within the episode. The only explanation offered for this is Roddenberry's relativistic approach stating that passage of time was altered according to the vector of the ship.

"Star Trek: The Next Generation" (Original airdate 1987) brought with it a new Stardate system. They employed a five number system in the form of 4XXXX to distance themselves from the time of the original series. The producers seem to have arbitrarily chosen the first number of the five number system (4), but the second number represents the season (1,2,3...). Interestingly, according to an article at About.com, this system seems to have followed in "Star Trek: Voyager", where the 6th season (would've been TNG's 13th season) Stardates are 53XXX.

See a nodeshell, help a nodeshell.
Stardate 79840.7, da-x's log, supplemental:

One bright day a few years ago, I ran the date UNIX command on my box, and a thought bumped to my head about why I don't see the current stardate every now and then, and as a sworn Trekkie I felt something is missing in my computing experience.

So I fired up google and read a few FAQs about stardates. Soon I found what I think is the best stardate representation and calculation which correlates nicely to the Star Trek show. It is based on a research which was done on each and every occurrences of stardates in Star Trek.

([c]) X(.Y)
• X - A decimal number which ranges from 0 to 99999 and rounds up every 100 solar years, so that each 1000 units is one solar year. The epoch for this is January 1, 2323, 00:00 UTC. For example, January 1, 2373, is roughly stardate 50000, and July 1, 2389 is around 66500. About dates before 2323, the 100 years roundup goes also backward, so July 1, 2289 is also 66500. Since seasons in Star Trek shows are per year, you notice a roughly 1000 differential between consecutive seasons.
• c - In order to resolve the ambiguousness revolving X, c is an optional integer for the number of centuries that set your distance form 2323. For example, July 1, 1989: around stardate [-4] 66500.
• .Y - An optional extension to the date which stands for the part of day. Note that the point is not a floating point for X, it's just a separator. The Y number can be one or more digits, which determine the precision. 3 digits of Y would be the equivalent of Internet Time. On Captain's log, there's almost always only one digit.

The next Perl function calculates a Stardate according to the method described above:

```sub stardate {
my \$t = shift;
my \$precision = shift;

my \$stardate_epoch = 11139552000;
my \$absolute = ((\$t - \$stardate_epoch) / (31556.952));
my \$centuries = int(\$absolute/100000)-1;
my \$relative = int(\$absolute - \$centuries*100000 + 0.5);
my \$part_of_day = ((\$t - \$stardate_epoch) % 86400)/86400.0;
my \$part_of_day_str = sprintf("%.".\$precision."f", \$part_of_day);
my \$choped_part_of_day = substr(\$part_of_day_str, 2, length(\$part_of_day_str)-2);

return sprintf("%d.%s", \$relative, \$choped_part_of_day);
}
```
The first parameter is the UNIX time, and the second is the part-of-day precision. Example: stardate(time(), 3) -> 79858.386.

So fanatically, I've written a Window Maker applet which displays the current stardate along with a Starfleet logo. Here: http://karrde.gorfajn.com:8000/wmstardate . I once even modified ls to show stardates but that's too abhorring to put on the Internet.