List of usage examples for java.util Calendar TUESDAY
int TUESDAY
To view the source code for java.util Calendar TUESDAY.
Click Source Link
From source file:com.eryansky.common.utils.SysUtils.java
public static String getNowDateStr() { String result = dateFormat(getNowDate(), CHS_DATEFORMAT); Calendar c = Calendar.getInstance(); for (int i = 0; i < 8; i++) { c.add(Calendar.DAY_OF_MONTH, 1); @SuppressWarnings("unused") int e = c.get(Calendar.DAY_OF_WEEK); }/*ww w . java2s . c om*/ result += " "; switch (Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) { case Calendar.SUNDAY: return result + ""; case Calendar.MONDAY: return result + ""; case Calendar.TUESDAY: return result + ""; case Calendar.WEDNESDAY: return result + ""; case Calendar.THURSDAY: return result + ""; case Calendar.FRIDAY: return result + ""; case Calendar.SATURDAY: return result + ""; default: return result; } }
From source file:DateUtils.java
public static final String getDayString(int day) { switch (day) { case Calendar.SUNDAY: return "SUNDAY"; case Calendar.MONDAY: return "MONDAY"; case Calendar.TUESDAY: return "TUESDAY"; case Calendar.WEDNESDAY: return "WEDNESDAY"; case Calendar.THURSDAY: return "THURSDAY"; case Calendar.FRIDAY: return "FRIDAY"; case Calendar.SATURDAY: return "SATURDAY"; }//ww w . ja va2 s . c o m return ""; }
From source file:in.suraj.timetableswipe.BTechFragment.java
private void init() { rgroup = (RadioGroup) rootView.findViewById(R.id.rbgrp); rbMon = (RadioButton) rootView.findViewById(R.id.rbMon); rbTue = (RadioButton) rootView.findViewById(R.id.rbTue); rbWed = (RadioButton) rootView.findViewById(R.id.rbWed); rbThur = (RadioButton) rootView.findViewById(R.id.rbThur); rbFri = (RadioButton) rootView.findViewById(R.id.rbFri); tvLect1Name = (TextView) rootView.findViewById(R.id.tvLect1Name); tvLect1Prof = (TextView) rootView.findViewById(R.id.tvLect1Prof); tvLect2Name = (TextView) rootView.findViewById(R.id.tvLect2Name); tvLect2Prof = (TextView) rootView.findViewById(R.id.tvLect2Prof); tvLect3Name = (TextView) rootView.findViewById(R.id.tvLect3Name); tvLect3Prof = (TextView) rootView.findViewById(R.id.tvLect3Prof); tvLect4Name = (TextView) rootView.findViewById(R.id.tvLect4Name); tvLect4Prof = (TextView) rootView.findViewById(R.id.tvLect4Prof); tvLect5Name = (TextView) rootView.findViewById(R.id.tvLect5Name); tvLect5Prof = (TextView) rootView.findViewById(R.id.tvLect5Prof); Calendar c = Calendar.getInstance(); int dayOfWeek = c.get(Calendar.DAY_OF_WEEK); if (Calendar.MONDAY == dayOfWeek) { setUpMonday();//from w w w . j a v a 2s . c o m } else if (Calendar.TUESDAY == dayOfWeek) { setUpTuesday(); } else if (Calendar.WEDNESDAY == dayOfWeek) { setUpWednesday(); } else if (Calendar.THURSDAY == dayOfWeek) { setUpThursday(); } else if (Calendar.FRIDAY == dayOfWeek) { setUpFriday(); } else if (Calendar.SATURDAY == dayOfWeek) { tvLect1Name.setText("Saturday :)"); tvLect1Name.setTextColor(Color.RED); } else if (Calendar.SUNDAY == dayOfWeek) { tvLect1Name.setText("Sunday :)"); tvLect1Name.setTextColor(Color.RED); } }
From source file:ru.VirtaMarketAnalyzer.main.Wizard.java
public static void collectToJsonTradeAtCities(final String realm) throws IOException { final String baseDir = Utils.getDir() + by_trade_at_cities + File.separator + realm + File.separator; final String serviceBaseDir = Utils.getDir() + by_service + File.separator + realm + File.separator; final File baseDirFile = new File(baseDir); if (baseDirFile.exists()) { logger.info("? {}", baseDirFile.getAbsolutePath()); FileUtils.deleteDirectory(baseDirFile); }/*w w w . j a v a 2s . co m*/ final File serviceBaseDirFile = new File(serviceBaseDir); if (serviceBaseDirFile.exists()) { logger.info("? {}", serviceBaseDirFile.getAbsolutePath()); FileUtils.deleteDirectory(serviceBaseDirFile); } //? final List<Country> countries = CityInitParser .getCountries(host + realm + "/main/common/main_page/game_info/world/"); Utils.writeToGson(baseDir + "countries.json", countries); final List<Country> countries_en = CityInitParser .getCountries(host_en + realm + "/main/common/main_page/game_info/world/"); Utils.writeToGson(baseDir + "countries_en.json", countries_en); // final List<Region> regions = CityInitParser.getRegions(host + realm + "/main/geo/regionlist/", countries); Utils.writeToGson(baseDir + "regions.json", regions); final List<Region> regions_en = CityInitParser.getRegions(host_en + realm + "/main/geo/regionlist/", countries); Utils.writeToGson(baseDir + "regions_en.json", regions_en); // ? final List<City> cities = CityListParser.fillWealthIndex(host + realm + "/main/geo/citylist/", regions); Utils.writeToGson(baseDir + "cities.json", cities); final List<City> cities_en = CityListParser.fillWealthIndex(host_en + realm + "/main/geo/citylist/", regions); Utils.writeToGson(baseDir + "cities_en.json", cities_en); logger.info("cities.size() = {}, realm = {}", cities.size(), realm); logger.info(" ?? ? "); final List<Product> products = ProductInitParser.getTradingProducts(host, realm); Utils.writeToGson(baseDir + "products.json", products); final List<Product> products_en = ProductInitParser.getTradingProducts(host_en, realm); Utils.writeToGson(baseDir + "products_en.json", products_en); logger.info("products.size() = {}, realm = {}", products.size(), realm); saveProductImg(products); logger.info(" ?? ? ??"); final List<UnitType> unitTypes = ServiceInitParser.getServiceUnitTypes(host, realm); Utils.writeToGson(serviceBaseDir + "service_unit_types.json", unitTypes); final List<UnitType> unitTypes_en = ServiceInitParser.getServiceUnitTypes(host_en, realm); Utils.writeToGson(serviceBaseDir + "service_unit_types_en.json", unitTypes_en); logger.info("service_unit_types.size() = {}, realm = {}", unitTypes.size(), realm); saveUnitTypeImg(unitTypes); final Calendar today = Calendar.getInstance(); if ("olga".equalsIgnoreCase(realm) && (today.get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY || today.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)) { } else if ("anna".equalsIgnoreCase(realm) && today.get(Calendar.DAY_OF_WEEK) == Calendar.TUESDAY) { } else if ("mary".equalsIgnoreCase(realm) && today.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) { } else if ("lien".equalsIgnoreCase(realm) && today.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) { } else if ("vera".equalsIgnoreCase(realm) && (today.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY || today.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)) { } else if ("fast".equalsIgnoreCase(realm)) { } else { return; } logger.info( " ?? ? "); final List<ProductCategory> product_categories = ProductInitParser.getProductCategories(products); Utils.writeToGson(baseDir + "product_categories.json", product_categories); final List<ProductCategory> product_categories_en = ProductInitParser.getProductCategories(products_en); Utils.writeToGson(baseDir + "product_categories_en.json", product_categories_en); logger.info(" ?"); final List<Product> materials = ProductInitParser.getProducts(host, realm); final Map<String, List<CountryDutyList>> countriesDutyList = CountryDutyListParser .getAllCountryDutyList(host + realm + "/main/geo/countrydutylist/", countries, materials); for (final Map.Entry<String, List<CountryDutyList>> entry : countriesDutyList.entrySet()) { Utils.writeToGson(baseDir + countrydutylist + File.separator + entry.getKey() + ".json", entry.getValue()); } logger.info("? "); final Map<String, List<TradeAtCity>> stats = CityParser.collectByTradeAtCities(host, realm, cities, products, countriesDutyList, regions); //?? json for (final Map.Entry<String, List<TradeAtCity>> entry : stats.entrySet()) { Utils.writeToGson(baseDir + "tradeAtCity_" + entry.getKey() + ".json", entry.getValue()); } logger.info(" ? "); final DateFormat df = new SimpleDateFormat("dd.MM.yyyy"); Utils.writeToGson(baseDir + "updateDate.json", new UpdateDate(df.format(new Date()))); logger.info("? "); final List<Shop> shops = TopRetailParser.getShopList(realm, stats, products); logger.info( " ?? ? "); final Map<String, List<RetailAnalytics>> retailAnalytics = PrepareAnalitics .getRetailAnalitincsByProducts(shops, stats, products); for (final Map.Entry<String, List<RetailAnalytics>> entry : retailAnalytics.entrySet()) { Utils.writeToGsonZip(baseDir + RetailSalePrediction.RETAIL_ANALYTICS_ + entry.getKey() + ".json", entry.getValue()); } logger.info(" ?? "); for (final UnitType ut : unitTypes) { final List<ServiceAtCity> serviceAtCity = ServiceAtCityParser.get(host, realm, cities, ut, regions); Utils.writeToGson(serviceBaseDir + "serviceAtCity_" + ut.getId() + ".json", serviceAtCity); } for (final UnitType ut : unitTypes_en) { final List<ServiceAtCity> serviceAtCity_en = ServiceAtCityParser.get(host_en, realm, cities_en, ut, regions_en); Utils.writeToGson(serviceBaseDir + "serviceAtCity_" + ut.getId() + "_en.json", serviceAtCity_en); } logger.info(" ? "); Utils.writeToGson(serviceBaseDir + "updateDate.json", new UpdateDate(df.format(new Date()))); // ? // RetailSalePrediction.createPrediction(realm, retailAnalytics, products); }
From source file:de.tor.tribes.ui.components.DatePicker.java
/** * remaps the days of week of gregorian Calendar to internal values *///from w w w .j a v a 2s . co m private int mapDayOfWeek(int cal) { switch (cal) { case Calendar.MONDAY: return 1; case Calendar.TUESDAY: return 2; case Calendar.WEDNESDAY: return 3; case Calendar.THURSDAY: return 4; case Calendar.FRIDAY: return 5; case Calendar.SATURDAY: return 6; case Calendar.SUNDAY: return 7; default: return 1; //should never happen } }
From source file:org.davidmendoza.esu.service.impl.InicioServiceImpl.java
private String obtieneDia(int dia) { switch (dia) { case Calendar.SUNDAY: return "domingo"; case Calendar.MONDAY: return "lunes"; case Calendar.TUESDAY: return "martes"; case Calendar.WEDNESDAY: return "miercoles"; case Calendar.THURSDAY: return "jueves"; case Calendar.FRIDAY: return "viernes"; default:/*from w w w . j a v a2s.c o m*/ return "sabado"; } }
From source file:org.eevolution.form.CRP.java
/** * Create Category Dataset based on date start and resource * @param start//from www . ja v a 2 s .c o m * @param resource * @return CategoryDataset */ protected CategoryDataset createDataset(Timestamp start, MResource resource) { GregorianCalendar gc1 = new GregorianCalendar(); gc1.setTimeInMillis(start.getTime()); gc1.clear(Calendar.MILLISECOND); gc1.clear(Calendar.SECOND); gc1.clear(Calendar.MINUTE); gc1.clear(Calendar.HOUR_OF_DAY); Timestamp date = start; String namecapacity = Msg.translate(Env.getCtx(), "Capacity"); String nameload = Msg.translate(Env.getCtx(), "Load"); String namesummary = Msg.translate(Env.getCtx(), "Summary"); MResourceType t = MResourceType.get(Env.getCtx(), resource.getS_ResourceType_ID()); int days = 1; long hours = t.getTimeSlotHours(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); // Long Hours = new Long(hours); int C_UOM_ID = DB.getSQLValue(null, "SELECT C_UOM_ID FROM M_Product WHERE S_Resource_ID = ? ", resource.getS_Resource_ID()); MUOM uom = MUOM.get(Env.getCtx(), C_UOM_ID); if (!uom.isHour()) { return dataset; } long summary = 0; while (days < 32) { String day = new String(new Integer(date.getDate()).toString()); long HoursLoad = getLoad(resource, date).longValue(); Long Hours = new Long(hours); switch (gc1.get(Calendar.DAY_OF_WEEK)) { case Calendar.SUNDAY: days++; if (t.isOnSunday()) { dataset.addValue(hours, namecapacity, day); dataset.addValue(HoursLoad, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary + Hours.intValue() - (HoursLoad); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } else { dataset.addValue(0, namecapacity, day); dataset.addValue(HoursLoad, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary - (HoursLoad); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } case Calendar.MONDAY: days++; if (t.isOnMonday()) { dataset.addValue(hours, namecapacity, day); dataset.addValue(HoursLoad, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary + Hours.intValue() - (HoursLoad); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } else { dataset.addValue(0, namecapacity, day); dataset.addValue(HoursLoad, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary - (HoursLoad); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } case Calendar.TUESDAY: days++; if (t.isOnTuesday()) { dataset.addValue(hours, namecapacity, day); dataset.addValue(HoursLoad, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary + Hours.intValue() - (HoursLoad); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } else { dataset.addValue(0, namecapacity, day); dataset.addValue(HoursLoad, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary - (HoursLoad); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } case Calendar.WEDNESDAY: days++; if (t.isOnWednesday()) { dataset.addValue(hours, namecapacity, day); dataset.addValue(HoursLoad, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary + Hours.intValue() - (HoursLoad); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } else { dataset.addValue(0, namecapacity, day); dataset.addValue(HoursLoad, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary - (HoursLoad); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } case Calendar.THURSDAY: days++; if (t.isOnThursday()) { dataset.addValue(hours, namecapacity, day); dataset.addValue(HoursLoad, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary + Hours.intValue() - (HoursLoad); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } else { dataset.addValue(0, namecapacity, day); dataset.addValue(HoursLoad, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary - (HoursLoad); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } case Calendar.FRIDAY: days++; if (t.isOnFriday()) { dataset.addValue(hours, namecapacity, day); dataset.addValue(HoursLoad, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary + Hours.intValue() - (HoursLoad); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } else { dataset.addValue(0, namecapacity, day); dataset.addValue(HoursLoad, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary - (HoursLoad); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } case Calendar.SATURDAY: days++; if (t.isOnSaturday()) { dataset.addValue(hours, namecapacity, day); dataset.addValue(HoursLoad, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary + Hours.intValue() - (HoursLoad); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } else { dataset.addValue(0, namecapacity, day); dataset.addValue(HoursLoad, nameload, day); dataset.addValue(summary, namesummary, day); summary = summary - (HoursLoad); gc1.add(Calendar.DATE, 1); date = new Timestamp(gc1.getTimeInMillis()); break; } } } return dataset; }
From source file:com.stratelia.webactiv.util.DateUtilTest.java
@Test public void testAddDays() { Calendar calend = Calendar.getInstance(); calend.set(Calendar.DATE, 27); calend.set(Calendar.MONTH, Calendar.JUNE); calend.set(Calendar.YEAR, 2012); calend.setTimeZone(TimeZone.getTimeZone("GMT+01")); assertThat(calend.get(Calendar.DAY_OF_WEEK), is(Calendar.WEDNESDAY)); DateUtil.addDaysExceptWeekEnds(calend, 2); assertThat(calend.get(Calendar.DAY_OF_WEEK), is(Calendar.FRIDAY)); assertThat(calend.get(Calendar.DATE), is(29)); assertThat(calend.get(Calendar.MONTH), is(Calendar.JUNE)); assertThat(calend.get(Calendar.YEAR), is(2012)); calend = Calendar.getInstance(); calend.set(Calendar.DATE, 27); calend.set(Calendar.MONTH, Calendar.JUNE); calend.set(Calendar.YEAR, 2012); calend.setTimeZone(TimeZone.getTimeZone("GMT+01")); assertThat(calend.get(Calendar.DAY_OF_WEEK), is(Calendar.WEDNESDAY)); DateUtil.addDaysExceptWeekEnds(calend, 4); assertThat(calend.get(Calendar.DAY_OF_WEEK), is(Calendar.TUESDAY)); assertThat(calend.get(Calendar.DATE), is(3)); assertThat(calend.get(Calendar.MONTH), is(Calendar.JULY)); assertThat(calend.get(Calendar.YEAR), is(2012)); }
From source file:org.davidmendoza.esu.service.impl.InicioServiceImpl.java
private Integer obtieneDia(String dia) { switch (dia) { case "domingo": return Calendar.SUNDAY; case "lunes": return Calendar.MONDAY; case "martes": return Calendar.TUESDAY; case "miercoles": return Calendar.WEDNESDAY; case "jueves": return Calendar.THURSDAY; case "viernes": return Calendar.FRIDAY; default:/*from w ww . ja v a 2s. c o m*/ return Calendar.SATURDAY; } }
From source file:com.autentia.jsf.component.ocupation.HtmlOcupationCalendarRenderer.java
private static String[] mapShortWeekdays(DateFormatSymbols symbols) { String[] weekdays = new String[7]; String[] localeWeekdays = symbols.getShortWeekdays(); weekdays[0] = localeWeekdays[Calendar.MONDAY]; weekdays[1] = localeWeekdays[Calendar.TUESDAY]; weekdays[2] = localeWeekdays[Calendar.WEDNESDAY]; weekdays[3] = localeWeekdays[Calendar.THURSDAY]; weekdays[4] = localeWeekdays[Calendar.FRIDAY]; weekdays[5] = localeWeekdays[Calendar.SATURDAY]; weekdays[6] = localeWeekdays[Calendar.SUNDAY]; return weekdays; }