ecma_date_date_from_time (ecma_number_t time) /**< time value */
{
  JERRY_ASSERT (!ecma_number_is_nan (time));

  int32_t year = ecma_date_year_from_time (time);
  int32_t day_within_year = ecma_date_day_from_time (time) - ecma_date_day_from_year (year);

  JERRY_ASSERT (day_within_year >= 0 && day_within_year < ECMA_DATE_DAYS_IN_LEAP_YEAR);

  int32_t in_leap_year = ecma_date_in_leap_year (year);

  int32_t month = 11;

  for (int i = 1; i < 12; i++)
  {
    if (day_within_year < first_day_in_month[in_leap_year][i])
    {
      month = i - 1;
      break;
    }
  }

  return day_within_year + 1 - first_day_in_month[in_leap_year][month];
} /* ecma_date_date_from_time */
ecma_date_date_from_time (ecma_number_t time)  
{
  JERRY_ASSERT (!ecma_number_is_nan (time));

  int32_t year = ecma_date_year_from_time (time);
  int32_t day_within_year = ecma_date_day_from_time (time) - ecma_date_day_from_year (year);

  JERRY_ASSERT (day_within_year >= 0 && day_within_year < ECMA_DATE_DAYS_IN_LEAP_YEAR);

  int32_t in_leap_year = ecma_date_in_leap_year (year);

  int32_t month = 11;

  for (int i = 1; i < 12; i++)
  {
    if (day_within_year < first_day_in_month[in_leap_year][i])
    {
      month = i - 1;
      break;
    }
  }

  return day_within_year + 1 - first_day_in_month[in_leap_year][month];
}  