Since this community helped me out in fixing the errors and stuff, …here!
It has complete dates with even the number of days for each individual month and even for leap years. (Leap years - Well up to 2020, but you can add others in)
If used please give credit
EDIT: Oh and almost forgot the var speedtime doesn’t work since I couldn’t figure out how to use it to speed up time
//========================================KAYDEN=====================================
//===================================DRAPIK================================================
//Upcoming MMORPG facebook.com/Drapik
var Year = 2012;
var Month = 1;
//var Week = 0;
var Day = 1;
var Hour = 0;
var Minute = 0;
var seconds : float = 1;
var speedtime = 0;
//Private vars
private var YearCalculator = 2012;
private var MonthCalculator = 1;
//private var WeekCalculator = 0;
private var DayCalculator = 1;
private var HourCalculator = 0;
private var MinuteCalculator = 0;
private var SecondCalculator = 0;
function Start () {
}
// Seconds to Minutes
function Update() {
seconds += Time.deltaTime;
if (seconds >= 60){
seconds=0;
Minute +=1;
}
//Minutes to Hours
Minute += Time.deltaTime;
if (Minute >= 60){
Minute=0;
Hour +=1;
}
//Hours to Day
Hour += Time.deltaTime;
if (Hour >= 24){
Hour=0;
Day +=1;
}
//Day to Month
Day += Time.deltaTime;
//Jan
if (Month ==1 Day ==32){
Day=1;
Month +=1;
}
//Feb
//If leap year
if (Month ==2 Day ==30 Year ==2012 || Month ==2 Day ==30 Year ==2016 || Month ==2 Day ==30 Year ==2020){
Day=1;
Month +=1;
}
//If not a leap year
else if (Month ==2 Day ==29 Year ==2013 || Month ==2 Day ==29 Year ==2014 || Month ==2 Day ==29 Year ==2015){
Day=1;
Month +=1;
}
//March
if (Month ==3 Day ==32){
Day=1;
Month +=1;
}
//April
if (Month ==4 Day ==31){
Day=1;
Month +=1;
}
//May
if (Month ==5 Day ==32){
Day=1;
Month +=1;
}
//June
if (Month ==6 Day ==31){
Day=1;
Month +=1;
}
//July
if (Month ==7 Day ==32){
Day=1;
Month +=1;
}
//August
if (Month ==8 Day ==32){
Day=1;
Month +=1;
}
//September
if (Month ==9 Day ==31){
Day=1;
Month +=1;
}
//October
if (Month ==10 Day ==32){
Day=1;
Month +=1;
}
//November
if (Month ==11 Day ==31){
Day=1;
Month +=1;
}
//December
if (Month ==12 Day ==32){
Day=1;
Month +=1;
}
//Month to Year
Month += Time.deltaTime;
if (Month > 12){
Month=1;
Year +=1;
}
}