...

View Full Version : What would I do for this script?



alman9898
07-11-2004, 02:30 AM
Ok, Im a newbie at Javascript and I have been looking for someone to help me make a script, but they all want money. :rolleyes:

I would like to have a script that displays the date as the ancient Romans would -- this includes the day of the week, date of the month (see below), the month itself, and the year in Roman numerals measured in AUC (ab urbe condita -- from the founding of the city. The Romans started their time from the founding of Rome in 753 BC. So, in order to get the current year in Roman times, just add 753 to the current year -- this year would be 2757 AUC, but use Roman numerals (MMDCCLVII).

So this is the exact format I'd like:

day of week, date of month, month, year (auc) in roman numerals.

***

REFERENCE OF ROMAN DATING SYSTEM

January -- Ianuarius
February -- Februarius
March -- Martius
April -- Aprilis
May -- Maius
June -- Iunius
August -- Augustus
September -- September
October -- October
November -- November
December -- December

dies Solis -- Sunday
dies Lunae -- Monday
dies Martis -- Tuesday
dies Mercurii -- Wednesday
dies Iovis -- Thursday
dies Veneris -- Friday
dies Saturni -- Saturday

***


DAYS OF THE MONTH

The Roman days of the month are a little different to ours. They had key days on each month and each day of the month is given as the number of days (including both the day in question and the key day) to the next key day.

To illustrate this, the key days are:

Kal. (Kalendae) - Kalends is the first day of each month
Non. (Nonae) - Nones are the ninth day before the Ides - i.e. the 5th (or 7th) day
Id. (Idus) - Ides are the 13th day of each month (in March, July, October, and May, the Ides is the 15th day)
For the key day of the month, the day is given by [key day] [month]. So Jan 5th would be Nonae Ianuariis - abbreviated to Non. Ian.

For the day of the month immediately before the key day, the day is given by: 'pridie' [key day] [month of key day]. So the Dec 31st would be pridie Kalendas Ianuarias - abbreviated to prid. Kal. Ian.

For the other days of the month, the day is given by: 'ante diem' [no. days to next key day] [key day] [month of key day] where the number of days to the next key day includes both the day in question and the key day. So the Jan 8th comes 6 days before the Ides of January (8,9,10,11,12,13) and so would be ante diem VI Idus Ianuarias - abbreviated to a.d. VI Id. Ian.

Between 45BC and 8AD, January, March, May, July, September, and November each had 31 days while the other months each had 30 days except February which had 29 days in standard years and 30 days in leap years. In 8AD, this was changed by Emperor Augustus so that his month (August) could have 31 days and the days of the months were rearranged and ended up in their current form.

What I'd like to know is how I would go along addressing the issue with converting regular numbers into Roman numerals and calculating the Kalends, Nones, and Ides of the months.

I know this is an advanced question for a n00b, but I'm making a Web site right now for an internet clan and I thought this would be a cool script to include.

Script Im using until I can get some help:


<script type="text/javascript"><!--
var now = new Date();
var dayNames = new Array("dies Solis", "dies Lunae", "dies Martis", "dies Mercurii",
"dies Iovis", "dies Veneris", "dies Saturni");
var monNames = new Array("Ianuarius", "Februarius", "Martius ",
"Aprilis", "Maius", "Iunius",
"Iulius", "Augustus ", "September",
"October", "November", "December");
var dateNames = new Array("I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","XIII","XIV","XV","XVI","XVII",
"XVIII","XIX","XX","XXI","XXII","XXIII","XXIV","XXV","XXVI","XXVII","XXVIII","XXIX","XXX","XXXI");
document.write(dayNames[now.getDay()] + ", " + dateNames[(now.getDate() - 1)] + " " + monNames[now.getMonth()] + ", " + "MMDCCLVII");
//-->
</script>

Willy Duitt
07-11-2004, 03:44 AM
A quick Google search returned this (http://www.guernsey.net/~sgibbs/roman.html)....
If you source the page, the script is right there.......

alman9898
07-11-2004, 04:02 AM
1.) thats illegal I believe to steal ones work
2.) thats a converter I believe, but I'll check it out... :thumbsup:

On that page


Please do not rip off this material to your webspace.

Willy Duitt
07-11-2004, 04:18 AM
I was not suggesting that you rip the entire page....
I was suggesting that you look at the source code and see how he did it.....

alman9898
07-11-2004, 05:17 AM
Ok.... but it also deals with a forms and other excess stuff that I won't need.

It's also off by a day ;)

I guess this site would supplement as well but it too converts..

http://www.24hourtranslations.co.uk/dates.htm

can you tell me what parts I should use? thanks :thumbsup:

alman9898
07-11-2004, 05:49 AM
hate to DP but I found a good script, but Im trying to modify it: can you tell whats wrong with it?


<script type="text/javascript"><!--
function romanCalendar()
{
// Initialise and fill variables
var dayArray = new Array("Kal.", "Non.", "Id.");
var monthArray = new Array("Ian.", "Feb.", "Mart.", "Apr.", "Mai.", "Iun.", "Iul.", "Aug.", "Sept.", "Oct.", "Nov.", "Dec.");
var monthLengthArray = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
var numeralArray = new Array("I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX");
var weekDay = new Array("dies Solis", "dies Lunae", "dies Martis", "dies Mercurii",
"dies Iovis", "dies Veneris", "dies Saturni");
var currentDate = new Date();

var kalends = 1;
var nonae;
var idus;
var monthNumber = currentDate.getMonth() + 1;
var dayNumber = currentDate.getDate() + 1;
var Day = currentDate.getDay();

// Test for leap year
if(currentDate.getYear() % 4 == 0)
monthArray[1] = 29;

// Calculate key dates of month
if(monthNumber == 3 || monthNumber == 5 || monthNumber == 7 || monthNumber == 10)
{
nonae = 7;
}
else nonae = 5;
if(monthNumber == 3 || monthNumber == 5 || monthNumber == 7 || monthNumber == 10)
{
idus = 15;
}
else idus = 13;

// Calculate date
if(dayNumber == kalends)
{
this.Calendar.innerHTML = weekDay[Day] + ", " + dayArray[0] + " " + monthArray[monthNumber-1] + ", " + "MMDCCLVII";
}
else if(dayNumber == nonae)
{
this.Calendar.innerHTML = weekDay[Day] + ", " + dayArray[1] + " " + monthArray[monthNumber-1] + ", " + "MMDCCLVII";
}
else if(dayNumber == idus)
{
this.Calendar.innerHTML = weekDay[Day] + ", " + dayArray[2] + " " + monthArray[monthNumber-1] + ", " + "MMDCCLVII";
}
else if(dayNumber > 1 && dayNumber < nonae)
{
if(dayNumber == nonae - 1)
this.Calendar.innerHTML = weekDay[Day] + ", " + "Prid. Non. " + monthArray[monthNumber-1] + ", " + "MMDCCLVII";
else
this.Calendar.innerHTML = weekDay[Day] + "," + numeralArray[nonae-dayNumber] + " Non. " + monthArray[monthNumber-1] + ", " + "MMDCCLVII";
}
else if(dayNumber > nonae && dayNumber < idus)
{
if(dayNumber == idus - 1)
this.Calendar.innerHTML = weekDay[Day] + ", " + "Prid. Id. " + monthArray[monthNumber-1] ", " + "MMDCCLVII";
else
this.Calendar.innerHTML = weekDay[Day] + "," + numeralArray[idus-dayNumber] + " Id. " + monthArray[monthNumber-1] ", " + "MMDCCLVII";
}
else if(dayNumber > idus)
{
if(dayNumber == monthLengthArray[monthNumber-1])
this.Calendar.innerHTML = weekDay[Day] + ", " + "Prid. Kal. " + monthArray[monthNumber] + ", " + "MMDCCLVII";
else
this.Calendar.innerHTML = weekDay[Day] + "," + numeralArray[monthLengthArray[monthNumber-1]-dayNumber+1] + " Kal. " + monthArray[monthNumber] + ", " + "MMDCCLVII";
}
}
//-->
</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum