Lines Matching refs:ec
2259 UErrorCode ec = U_ZERO_ERROR;
2267 Calendar* pcal = Calendar::createInstance(Locale::getUS(), ec);
2268 if(U_FAILURE(ec)) {
2269 dataerrln("Error creating calendar %s", u_errorName(ec));
2275 SimpleDateFormat fmt(UnicodeString("MMM dd yyyy",""), ec);
2278 if (U_SUCCESS(ec)) {
2289 UDate date1 = cal.getTime(ec);
2290 if (failure(ec, "getTime"))
2293 UDate date2 = cal.getTime(ec);
2294 if (failure(ec, "getTime"))
2297 cal.setTime(date1, ec);
2298 if (failure(ec, "setTime"))
2300 int32_t dy = cal.fieldDifference(date2, UCAL_YEAR, ec);
2301 int32_t dm = cal.fieldDifference(date2, UCAL_MONTH, ec);
2302 int32_t dd = cal.fieldDifference(date2, UCAL_DATE, ec);
2303 if (failure(ec, "fieldDifference"))
2315 if (failure(ec2, "fieldDifference(date, Calendar::DATE, ec)"))
2331 cal.setTime(date1, ec);
2332 if (failure(ec, "setTime"))
2334 cal.add(UCAL_YEAR, dy, ec);
2335 cal.add(UCAL_MONTH, dm, ec);
2336 cal.add(UCAL_DATE, dd, ec);
2337 if (failure(ec, "add"))
2339 UDate date22 = cal.getTime(ec);
2340 if (failure(ec, "getTime"))
2356 dataerrln("Error creating SimpleDateFormat - %s", u_errorName(ec));
2363 ec = U_ZERO_ERROR;
2364 Calendar *cal = Calendar::createInstance(ec);
2366 if (cal == NULL || U_FAILURE(ec)) {
2367 dataerrln("FAIL: Calendar::createInstance(): %s", u_errorName(ec));
2376 cal->add(UCAL_MONTH, 36, ec);
2381 cal->getTime(ec);
2385 yy = cal->get(UCAL_YEAR, ec);
2386 mm = cal->get(UCAL_MONTH, ec);
2387 dd = cal->get(UCAL_DATE, ec);
2388 ee = cal->get(UCAL_DAY_OF_WEEK, ec);
2391 if (U_FAILURE(ec) || yy != 2010 || mm != UCAL_FEBRUARY || dd != 24 || ee != UCAL_WEDNESDAY) {
2476 UErrorCode ec = U_ZERO_ERROR;
2477 Calendar* cal = Calendar::createInstance(ec);
2478 if (cal == NULL || U_FAILURE(ec)) {
2479 dataerrln("FAIL: Calendar::createInstance(): %s", u_errorName(ec));
2484 UDate date2004 = cal->getTime(ec);
2486 UDate date2000 = cal->getTime(ec);
2487 if (U_FAILURE(ec)) {
2492 int32_t y = cal->fieldDifference(date2004, UCAL_YEAR, ec);
2493 int32_t d = cal->fieldDifference(date2004, UCAL_DAY_OF_YEAR, ec);
2494 if (U_FAILURE(ec)) {
2504 cal->setTime(date2004, ec);
2505 y = cal->fieldDifference(date2000, UCAL_YEAR, ec);
2506 d = cal->fieldDifference(date2000, UCAL_DAY_OF_YEAR, ec);
2507 if (U_FAILURE(ec)) {
2519 UDate ayl = cal->getTime(ec);
2521 UDate asl = cal->getTime(ec);
2522 if (U_FAILURE(ec)) {
2527 d = cal->fieldDifference(ayl, UCAL_DATE, ec);
2528 cal->setTime(ayl, ec);
2529 int32_t d2 = cal->fieldDifference(asl, UCAL_DATE, ec);
2530 if (U_FAILURE(ec)) {
2549 UErrorCode ec = U_ZERO_ERROR;
2550 Calendar* cal = Calendar::createInstance(loc, ec);
2551 if (U_FAILURE(ec)) {
2552 dataerrln("FAIL: Can't construct calendar for ms_MY: %s", u_errorName(ec));
2563 UErrorCode ec = U_ZERO_ERROR;
2565 Locale("en", "US"), ec);
2566 if (U_FAILURE(ec)) {
2567 dataerrln("Fail GregorianCalendar: %s", u_errorName(ec));
2570 cal.setTime(UDate(997257600000.0), ec); // Wed Aug 08 01:00:00 PDT 2001
2589 cal.add(UCAL_DATE, 1, ec); // Force recalc
2590 cal.add(UCAL_DATE, -1, ec);
2592 UDate time1 = cal.getTime(ec); // Get time -- should not change
2603 int32_t woy1 = cal.get(UCAL_WEEK_OF_YEAR, ec);
2604 int32_t wom1 = cal.get(UCAL_WEEK_OF_MONTH, ec);
2606 cal.add(UCAL_DATE, 1, ec); // Force recalc
2607 cal.add(UCAL_DATE, -1, ec);
2609 int32_t woy2 = cal.get(UCAL_WEEK_OF_YEAR, ec);
2610 int32_t wom2 = cal.get(UCAL_WEEK_OF_MONTH, ec);
2612 UDate time2 = cal.getTime(ec);
2614 if (U_FAILURE(ec)) {
2641 UErrorCode ec = U_ZERO_ERROR;
2643 SimpleDateFormat dateFormat("MM/dd/yyyy HH:mm z", locale, ec);
2654 while ((id = tz->unext(NULL, ec)) != NULL && U_SUCCESS(ec)) {
2655 if (U_FAILURE(ec)) {
2667 Calendar *cal = Calendar::createInstance(t, locale, ec);
2668 if (cal == NULL || U_FAILURE(ec)) {
2680 for (int32_t i=0; i<365+10 && U_SUCCESS(ec); ++i) {
2681 UDate yesterday = cal->getTime(ec);
2682 int32_t yesterday_day = cal->get(UCAL_DATE, ec);
2683 cal->add(UCAL_DATE, 1, ec);
2684 if (yesterday_day == cal->get(UCAL_DATE, ec)) {
2687 dateFormat.format(cal->getTime(ec), buf2));
2695 if (U_FAILURE(ec)) {
2696 dataerrln("FAIL: %s", u_errorName(ec));