# Zeller

**URL:** https://forum.kirupa.com/t/zeller/289805
**Category:** flash
**Created:** [June 4, 2009, 9:58pm UTC](https://forum.kirupa.com/t/zeller/289805 "2009-06-04T21:58:11Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Filipus\_Alexus](https://avatars.discourse-cdn.com/v4/letter/f/91b2a8/32.png) [@Filipus\_Alexus](https://forum.kirupa.com/u/Filipus_Alexus)
#### Post date: [June 4, 2009, 9:58pm UTC](https://forum.kirupa.com/t/zeller/289805/1 "2009-06-04T21:58:11Z")

</div>

Hello. Here we have a rather awkward question…  
I have found a javascript code that allows anyone to find the day of the week in which they were born. However, I am looking for a code that can be used in a “.fla” document.  
The export settings have to be “flash 9” and “action script 2.0”. This is simply because the rest of the .fla document has already been produced to that standard.  
So, having those 2 barriers in mind, does anyone know how to “translate” the javascript code into an operational ActionScript 2.0 that can be used inside a .fla document?

Thank you very much in advance!

The code follows:  
\<script LANGUAGE=“JavaScript”\>

\<!–

function cala\_day(form) {

var nSwitch = 0  
var nMonth = parseInt(form.month.value)  
var nDay = parseInt(form.day.value)  
var nYear = parseInt(form.year.value)

if(!(nYear % 4) && (nMonth \> 2)) {  
nSwitch = 1  
}

var nDayOfWeek = cala\_weekday(nMonth, nDay, nYear)

if(nSwitch) {  
nDayOfWeek++  
nSwitch = 0  
}

day\_display(form, nDayOfWeek)  
}

function cala\_weekday( x\_nMonth, x\_nDay, x\_nYear) {

if(x\_nMonth \>= 3){  
x\_nMonth -= 2  
}  
else {  
x\_nMonth += 10  
}

if( (x\_nMonth == 11) || (x\_nMonth == 12) ){  
x\_nYear–  
}

var nCentNum = parseInt(x\_nYear / 100)  
var nDYearNum = x\_nYear % 100

var nPart1 = parseInt(2.6 \* x\_nMonth - .2)

var nZeller = (parseInt(nPart1 + x\_nDay + nDYearNum + (nDYearNum / 4) + (nCentNum / 4) - 2 \* nCentNum)) % 7

if(nZeller \< 0){  
nZeller += 7  
}

return nZeller  
}

function day\_display(form, x\_nDayOfWeek) {

if(x\_nDayOfWeek == 0) {  
form.birthday.value = “Saturday”  
return  
}  
if(x\_nDayOfWeek == 1) {  
form.birthday.value = “Sunday”  
return  
}  
if(x\_nDayOfWeek == 2) {  
form.birthday.value = “Monday”  
return  
}  
if(x\_nDayOfWeek == 3) {  
form.birthday.value = “Tuesday”  
return  
}  
if(x\_nDayOfWeek == 4) {  
form.birthday.value = “Wednesday”  
return  
}  
if(x\_nDayOfWeek == 5) {  
form.birthday.value = “Thursday”  
return  
}  
if(x\_nDayOfWeek == 6) {  
form.birthday.value = “Friday”  
return  
}

form.birthday.value = “Invalid Date!”  
}  
–\>

\</script\>
