public static WikibaseDate fromSecondsSinceEpoch(long secondsSinceEpoch){
  long year=yearFromSecondsSinceEpoch(secondsSinceEpoch);
  int second=(int)(secondsSinceEpoch - calculateFirstDayOfYear(year) * SECONDS_PER_DAY);
  int month=1;
  long[] secondsPerMonthCumulative=secondsPerMonthCumulative(year);
  while (month < 12 && second >= secondsPerMonthCumulative[month]) {
    month++;
  }
  second-=secondsPerMonthCumulative[month - 1];
  int day=second / SECONDS_PER_DAY + 1;
  second%=SECONDS_PER_DAY;
  int hour=second / SECONDS_PER_HOUR;
  second%=SECONDS_PER_HOUR;
  int minute=second / SECONDS_PER_MINUTE;
  second%=SECONDS_PER_MINUTE;
  return new WikibaseDate(year,month,day,hour,minute,second);
}

public static WikibaseDate fromSecondsSinceEpoch ( long secondsSinceEpoch ) { long year = yearFromSecondsSinceEpoch ( secondsSinceEpoch ) ; int second = ( int ) ( secondsSinceEpoch - calculateFirstDayOfYear ( year ) * SECONDS_PER_DAY ) ; int month = 1 ; long [ ] secondsPerMonthCumulative = secondsPerMonthCumulative ( year ) ; while ( month < 12 && second >= secondsPerMonthCumulative [ month ] ) { month ++ ; } second -= secondsPerMonthCumulative [ month - 1 ] ; int day = second / SECONDS_PER_DAY + 1 ; second %= SECONDS_PER_DAY ; int hour = second / SECONDS_PER_HOUR ; second %= SECONDS_PER_HOUR ; int minute = second / SECONDS_PER_MINUTE ; second %= SECONDS_PER_MINUTE ; return new WikibaseDate ( year , month , day , hour , minute , second ) ; }
build a wikibasedate from seconds since epoch .
