Skip to content

DateSwap()

Returns a string from the XML if the date is valid or not


// --------------------
// -- DATE SWAP
// --------------------
function DateSwap():String
{
 var splitDate:Array =  X.DVDdate.split("/");

 var NowDate:String;
 var date:Date = new Date();
 var day:Number = date.getDate();
 var month:Number = date.getMonth();
 var realMonth:Number = Number( month + 1 );
 var validDate:Boolean = false;

 //trace("The clock on the machine is set to: " + realMonth + "/" + day);

 if( realMonth > Number( splitDate[0] * 1 ) )
 {
 validDate = true;
 }

 if( day >= Number( splitDate[1] * 1 )  && realMonth == Number( splitDate[0] * 1 ) )
 {
 validDate = true;
 }

 trace( validDate );

 if( validDate == true )
 {
 //trace( "\t NOW" );
 NowDate = X._xml.footer.DVDnow;
 } else {
 //trace( "\t NOT YET" );
 NowDate = X._xml.footer.DVDstreet;
 }
 /*
 trace("\t Month: STREET: " + splitDate[0] + " / CPU: " + realMonth );
 trace("\t Day: STREET: " + splitDate[1] + " / CPU: " +  day );
 trace( "[ NOW DATE = " + NowDate + " ]" );
 */
 return NowDate;
}

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*