Ejemplo n.º 1
0
void TimeVal::parseYearMonth()
{
  initParser();

  // get date
  getYearMonth();
  parser_context.fValue[Day] = DAY_DEFAULT;
  parseTimeZone();

  validateDateTime();
  xmlnormalize();
}
Ejemplo n.º 2
0
main()
{
  int year;     /* 西暦 */
  int month;    /* 月   */
  int days;     /* 月の日数 */
  int youbi;    /* 最初の日の曜日番号 */

  getYearMonth(&year, &month);
  days = getMonthDays(year, month);
  youbi = getWeekDay(year, month, 1);
  printf("西暦%d年 %d月\n", year, month);
  PrintCalendar(days, youbi);
}
Ejemplo n.º 3
0
//
// [-]{CCYY-MM-DD}
//
// Note: CCYY could be more than 4 digits
//       Assuming parser_context.fStart point to the beginning of the Date Section
//       parser_context.fStart updated to point to the position right AFTER the second 'D'
//       Since the lenght of CCYY might be variable, we can't check format upfront
//
void TimeVal::getDate()
{

  // Ensure enough chars in buffer
  if ( (parser_context.fStart+YMD_MIN_SIZE) > parser_context.fEnd)
    throw TimeValXMLParseErrorException("DateTime_date_incomplete", parser_context.fBuffer);

  getYearMonth();    // Scan YearMonth and
  // parser_context.fStart point to the next '-'

  if (parser_context.fBuffer[parser_context.fStart++] != DATE_SEPARATOR)
    {
      throw TimeValXMLParseErrorException("DateTime_date_invalid", parser_context.fBuffer);
      //("CCYY-MM must be followed by '-' sign");
    }

  parser_context.fValue[Day] = parseInt(parser_context.fStart, parser_context.fStart+2);
  parser_context.fStart += 2 ;  //parser_context.fStart points right after the Day

  return;
}