• Welcome to the new COTI server. We've moved the Citizens to a new server. Please let us know in the COTI Website issue forum if you find any problems.
  • We, the systems administration staff, apologize for this unexpected outage of the boards. We have resolved the root cause of the problem and there should be no further disruptions.

Date conversions

Any possibility of some one doing an app for converting imperil date to julian calendar dates? I'd do it myself, but I haven't a clue on writing code. :confused:
 
Well let's see,according tot he T5 book the Third Imperium started about 4521CE (Terran Calendar) so all you would need to do for years is add 4521 to the Imperial year to get the Terran year.

Dates are a bit more complicated due to leap years in the Julian calendar. It would be easier if you just want to go from Julian to Imperium, but of course that isn't what you asked. I'll see if I can come up with a formula for doing it and then someone can wrap it in nice code.
 
If you can read code the Template for dates in the wiki has a number of date conversions: http://wiki.travellerrpg.com/Template:Date

Actually, there isn't code in that page, but it does lead to the page on Date Conversions where you find a conversion chart, but I am having a hard time figuring it out.

The formula to go from Imperial to Solomani is (x * 1.0006644) + 4518. So for say, day 10 of year 0 you get 4528.007. How does that translate into a Terran date? Same going the other way, (x-4518)/ 1.0006644. What is x and how does it work?

On the other hand, I figured out how to go from Terran to Imperial in Excel. Put the Terran date in cell A2. Then in B2 put:

PHP:
=A2-Date(Year(A2),1,1)

Which will give you the day of the year (001-365)

And then in C2 put:

PHP:
=-1*(4518-YEAR(A2))


Which will give you the year, assuming that 4518 = Imperial 0.

Then you can us concatenate to put B2 and C2 together to get an Imperial date in the format of "001 0000". You just need to make sure that column A is formatted as DATE and the others as GENERAL.
 
Well let's see,according tot he T5 book the Third Imperium started about 4521CE (Terran Calendar) so all you would need to do for years is add 4521 to the Imperial year to get the Terran year.

Dates are a bit more complicated due to leap years in the Julian calendar. It would be easier if you just want to go from Julian to Imperium, but of course that isn't what you asked. I'll see if I can come up with a formula for doing it and then someone can wrap it in nice code.

That's Imperial, Not Vilani...

Vilani is ((current CE date) -463y)/1.312... so in the Vilani system, it would be Vilani year 1183 or so...

Then again, according to some current calendars on earth...
For those wanting to be poetic and traditional, it's the 27th year of the Akihito Era... until february, when it becomes the 28th year of the Akihito Era. (Mind you, he celebrates 27 years on the throne on Thursday). Or Kōki 144, for the pre-war patriots. 1437 Muslim reckoning, used in about 30 countries. 5776 Hebrew calendar. 7525 Anno Mundi (which was the Byzantine Empire's, and is used in several religions still).
 
Actually, there isn't code in that page, but it does lead to the page on Date Conversions where you find a conversion chart, but I am having a hard time figuring it out.
It is in the source for the template. Which is why I said if you can read code.
The formula to go from Imperial to Solomani is (x * 1.0006644) + 4518. So for say, day 10 of year 0 you get 4528.007. How does that translate into a Terran date? Same going the other way, (x-4518)/ 1.0006644. What is x and how does it work?
You need to convert the fractional part to a day number and then to a date. So day 10 is 10/365 of a year or 0.027. X becomes year + 0.027. Plug that into the formula. Then multiply the fractional part that comes out by 365 to get days.

Just remember that some calendars have a different number of days in a year.
 
It is in the source for the template. Which is why I said if you can read code.

You need to convert the fractional part to a day number and then to a date. So day 10 is 10/365 of a year or 0.027. X becomes year + 0.027. Plug that into the formula. Then multiply the fractional part that comes out by 365 to get days.

Just remember that some calendars have a different number of days in a year.

Okay, so let's say we want to convert 005 1105 to Terran.


Code:
X = 005/365 + 1105 = 1105.0137

(1105.0137 * 1.0006644) + 4518 = 5623.7479

.7479 * 365 = 272.9835

So 005 1105 Imperial is the 273rd day of 5623 Terran

Did I do that right?
 
I've got the conversion to the Julian calendar in an app at home. I'll have to (1) remember this post then (2) actually dig out the code, so I bet I'll forget.
 
Thanks for the response guy ! It's the months and days that give me a problem. What throws me is that the Imperial year doesn't seem to start in january. Plus I get confused easily. ;)
 
Perhaps you mean Julian Day, not the Julian calendar, right? The "Julian Day" is the number of days since November 24, 4714 BC, in the proleptic Gregorian calendar.

The trick is: once you code to the Julian day, you go find a package that converts between the JD and the Gregorian calendar. Then half of the annoying work is done for you.



Converting the Julian Day to the Gregorian date is a solved problem. For that matter, converting the Julian Day to any other dating system is easier than trying to do it from a Calendar date, which invariably deals with leap days and things.

[Current Vilani Date]
=> [Number of Vilani Days since Their Day Zero]
=> [Convert to Sol Days]
=> + [Offset to convert it to the Julian Day]
=> Then apply a conversion to any target calendar, for example the Gregorian calendar.

That's how I did it for the Imperial calendar, Aslan calendar, Zhodani, Vilani, and Solomani [Gregorian] calendar, heck I did it for the Shrieker calendar. I just never got the app to the app store before my license or whatever expired and XCode moved past my iPad 1.
 
Last edited:
Sorry, I may be getting ahead of things.

But perhaps Excel has Julian day / Gregorian Date functions.

(Update: maybe not)
 
Assuming a calendar date in the form MM/DD/YYYY is in cell A1:

Code:
=TEXT(A1,"yyyy")&TEXT((A1-DATEVALUE("1/1/"&TEXT(A1,"yy"))+1),"000")
 
Last edited:
Back
Top