List of usage examples for java.util Calendar MILLISECOND
int MILLISECOND
To view the source code for java.util Calendar MILLISECOND.
Click Source Link
get
and set
indicating the millisecond within the second. From source file:tr.com.turkcellteknoloji.turkcellupdater.Utilities.java
static Date getStartOfDate(Date date) { final Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/*from ww w. j a v a2 s.c o m*/ calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); }
From source file:org.activiti.rest.service.api.runtime.TaskCollectionResourceTest.java
/** * Test getting a collection of tasks. GET runtime/tasks *//*from w ww . j a va 2s .com*/ @Deployment public void testGetTasks() throws Exception { try { Calendar adhocTaskCreate = Calendar.getInstance(); adhocTaskCreate.set(Calendar.MILLISECOND, 0); Calendar processTaskCreate = Calendar.getInstance(); processTaskCreate.add(Calendar.HOUR, 2); processTaskCreate.set(Calendar.MILLISECOND, 0); Calendar inBetweenTaskCreation = Calendar.getInstance(); inBetweenTaskCreation.add(Calendar.HOUR, 1); processEngineConfiguration.getClock().setCurrentTime(adhocTaskCreate.getTime()); Task adhocTask = taskService.newTask(); adhocTask.setAssignee("gonzo"); adhocTask.setOwner("owner"); adhocTask.setDelegationState(DelegationState.PENDING); adhocTask.setDescription("Description one"); adhocTask.setName("Name one"); adhocTask.setDueDate(adhocTaskCreate.getTime()); adhocTask.setPriority(100); adhocTask.setCategory("some-category"); taskService.saveTask(adhocTask); taskService.addUserIdentityLink(adhocTask.getId(), "misspiggy", IdentityLinkType.PARTICIPANT); processEngineConfiguration.getClock().setCurrentTime(processTaskCreate.getTime()); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", "myBusinessKey"); Task processTask = taskService.createTaskQuery().processInstanceId(processInstance.getId()) .singleResult(); processTask.setParentTaskId(adhocTask.getId()); processTask.setPriority(50); processTask.setDueDate(processTaskCreate.getTime()); taskService.saveTask(processTask); // Check filter-less to fetch all tasks String url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION); assertResultsPresentInDataResponse(url, adhocTask.getId(), processTask.getId()); // Name filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?name=" + encode("Name one"); assertResultsPresentInDataResponse(url, adhocTask.getId()); // Name like filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?nameLike=" + encode("%one"); assertResultsPresentInDataResponse(url, adhocTask.getId()); // Description filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?description=" + encode("Description one"); assertResultsPresentInDataResponse(url, adhocTask.getId()); url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?description=" + encode("Description two"); assertEmptyResultsPresentInDataResponse(url); // Description like filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?descriptionLike=" + encode("%one"); assertResultsPresentInDataResponse(url, adhocTask.getId()); url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?descriptionLike=" + encode("%two"); assertEmptyResultsPresentInDataResponse(url); // Priority filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?priority=100"; assertResultsPresentInDataResponse(url, adhocTask.getId()); // Mininmum Priority filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?minimumPriority=70"; assertResultsPresentInDataResponse(url, adhocTask.getId()); // Maximum Priority filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?maximumPriority=70"; assertResultsPresentInDataResponse(url, processTask.getId()); // Owner filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?owner=owner"; assertResultsPresentInDataResponse(url, adhocTask.getId()); url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?owner=kermit"; assertEmptyResultsPresentInDataResponse(url); url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?ownerLike=" + encode("%ner"); assertResultsPresentInDataResponse(url, adhocTask.getId()); url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?ownerLike=" + encode("kerm%"); assertEmptyResultsPresentInDataResponse(url); // Assignee filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?assignee=gonzo"; assertResultsPresentInDataResponse(url, adhocTask.getId()); url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?assignee=kermit"; assertEmptyResultsPresentInDataResponse(url); url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?assigneeLike=" + encode("gon%"); assertResultsPresentInDataResponse(url, adhocTask.getId()); url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?assigneeLike=" + encode("kerm%"); assertEmptyResultsPresentInDataResponse(url); // Unassigned filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?unassigned=true"; assertResultsPresentInDataResponse(url, processTask.getId()); // Delegation state filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?delegationState=pending"; assertResultsPresentInDataResponse(url, adhocTask.getId()); // Candidate user filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?candidateUser=kermit"; assertResultsPresentInDataResponse(url, processTask.getId()); // Candidate group filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?candidateGroup=sales"; assertResultsPresentInDataResponse(url, processTask.getId()); // Involved user filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?involvedUser=misspiggy"; assertResultsPresentInDataResponse(url, adhocTask.getId()); // Process instance filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?processInstanceId=" + processInstance.getId(); assertResultsPresentInDataResponse(url, processTask.getId()); // Execution filtering Execution taskExecution = runtimeService.createExecutionQuery().activityId("processTask") .singleResult(); url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?executionId=" + taskExecution.getId(); assertResultsPresentInDataResponse(url, processTask.getId()); // Process instance businesskey filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?processInstanceBusinessKey=myBusinessKey"; assertResultsPresentInDataResponse(url, processTask.getId()); // CeatedOn filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?createdOn=" + getISODateString(adhocTaskCreate.getTime()); assertResultsPresentInDataResponse(url, adhocTask.getId()); // CreatedAfter filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?createdAfter=" + getISODateString(inBetweenTaskCreation.getTime()); assertResultsPresentInDataResponse(url, processTask.getId()); // CreatedBefore filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?createdBefore=" + getISODateString(inBetweenTaskCreation.getTime()); assertResultsPresentInDataResponse(url, adhocTask.getId()); // Subtask exclusion url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?excludeSubTasks=true"; assertResultsPresentInDataResponse(url, adhocTask.getId()); // Task definition key filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?taskDefinitionKey=processTask"; assertResultsPresentInDataResponse(url, processTask.getId()); // Task definition key like filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?taskDefinitionKeyLike=" + encode("process%"); assertResultsPresentInDataResponse(url, processTask.getId()); // Duedate filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?dueDate=" + getISODateString(adhocTaskCreate.getTime()); assertResultsPresentInDataResponse(url, adhocTask.getId()); // Due after filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?dueAfter=" + getISODateString(inBetweenTaskCreation.getTime()); assertResultsPresentInDataResponse(url, processTask.getId()); // Due before filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?dueBefore=" + getISODateString(inBetweenTaskCreation.getTime()); assertResultsPresentInDataResponse(url, adhocTask.getId()); // Without tenantId filtering before tenant set url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?withoutTenantId=true"; assertResultsPresentInDataResponse(url, adhocTask.getId(), processTask.getId()); // Process definition url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?processDefinitionKey=" + processInstance.getProcessDefinitionKey(); assertResultsPresentInDataResponse(url, processTask.getId()); url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?processDefinitionId=" + processInstance.getProcessDefinitionId(); assertResultsPresentInDataResponse(url, processTask.getId()); // Process instance id in list filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?processInstanceIdIn=" + adhocTask.getId() + "," + processInstance.getId(); assertResultsPresentInDataResponse(url, processTask.getId()); // Set tenant on deployment managementService.executeCommand(new ChangeDeploymentTenantIdCmd(deploymentId, "myTenant")); // Without tenantId filtering after tenant set, only adhoc task // should remain url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?withoutTenantId=true"; assertResultsPresentInDataResponse(url, adhocTask.getId()); // Tenant id filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?tenantId=myTenant"; assertResultsPresentInDataResponse(url, processTask.getId()); // Tenant id like filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?tenantIdLike=" + encode("%enant"); assertResultsPresentInDataResponse(url, processTask.getId()); // Category filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?category=" + encode("some-category"); assertResultsPresentInDataResponse(url, adhocTask.getId()); // Suspend process-instance to have a supended task runtimeService.suspendProcessInstanceById(processInstance.getId()); // Suspended filering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?active=false"; assertResultsPresentInDataResponse(url, processTask.getId()); // Active filtering url = RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_COLLECTION) + "?active=true"; assertResultsPresentInDataResponse(url, adhocTask.getId()); } finally { // Clean adhoc-tasks even if test fails List<Task> tasks = taskService.createTaskQuery().list(); for (Task task : tasks) { if (task.getExecutionId() == null) { taskService.deleteTask(task.getId(), true); } } } }
From source file:com.hyron.poscafe.CashRegister.java
public Date getAccountDate() { if (accountDate == null) { // If accountDate not set, return system date. Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); calendar.set(Calendar.HOUR, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); } else {//from w w w .ja va 2 s.c o m return accountDate; } }
From source file:com.tasktop.c2c.server.scm.service.GitServiceBean.java
private List<ScmSummary> createEmptySummaries(int numDays) { List<ScmSummary> result = new ArrayList<ScmSummary>(numDays); Calendar cal = Calendar.getInstance(tz); cal.setTime(new Date()); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 1);/*from w ww . j a va2s . c o m*/ cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); Long now = cal.getTimeInMillis(); for (int i = numDays - 1; i >= 0; i--) { ScmSummary summary = new ScmSummary(); summary.setDate(new Date(now - i * MILLISECONDS_PER_DAY)); summary.setAmount(0l); result.add(summary); } return result; }
From source file:com.heliumv.factory.impl.ZeiterfassungCall.java
private void modifyKommtGehtToNow(ZeitdatenDto zDto) throws RemoteException, NamingException, EJBExceptionLP { Integer taetigkeitId = zDto.getTaetigkeitIId(); if (taetigkeitId == null) return;//from w w w. j a va 2 s. c om if (taetigkeitId.equals(getCachedTaetigkeitId(ZeiterfassungFac.TAETIGKEIT_KOMMT)) || taetigkeitId.equals(getCachedTaetigkeitId(ZeiterfassungFac.TAETIGKEIT_GEHT)) || taetigkeitId.equals(getCachedTaetigkeitId(ZeiterfassungFac.TAETIGKEIT_UNTER))) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(System.currentTimeMillis()); c.set(Calendar.MILLISECOND, 0); c.set(Calendar.SECOND, 0); zDto.setTZeit(new Timestamp(c.getTimeInMillis())); } }
From source file:com.thoughtworks.go.domain.JobInstancesTest.java
private Date date(int year, int month, int day) { Calendar calendar = Calendar.getInstance(); calendar.set(year, month, day, 0, 0, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); }
From source file:com.autentia.tnt.manager.holiday.UserHolidaysStateManager.java
public UserHolidaysState calcUserHolidaysState(User usuario, Date chargeYear) { UserHolidaysState uhs = new UserHolidaysState(); uhs.setUser(usuario);// w ww . j a v a 2 s . com // WorkingAgreement attribute is an HB proxy not initialized, we need to get it from DB WorkingAgreementDAO workingAgreementDao = WorkingAgreementDAO.getDefault(); WorkingAgreement agreement = workingAgreementDao.getById(usuario.getAgreement().getId()); // and refresh the user instance agreement attribute usuario.setAgreement(agreement); uhs.setTotalYear(agreement.getHolidays()); int acceptedHolidays = 0; if (chargeYear != null) { HolidayManager fiestasManager = HolidayManager.getDefault(); // We must take in account previous year holidays and next year holidays Calendar calMin = Calendar.getInstance(); calMin.setTime(chargeYear); calMin.set(Calendar.MONTH, calMin.getMinimum(Calendar.MONTH)); calMin.set(Calendar.DAY_OF_MONTH, calMin.getMinimum(Calendar.DAY_OF_MONTH)); calMin.set(Calendar.HOUR_OF_DAY, calMin.getMinimum(Calendar.HOUR_OF_DAY)); calMin.set(Calendar.MINUTE, calMin.getMinimum(Calendar.MINUTE)); calMin.set(Calendar.SECOND, calMin.getMinimum(Calendar.SECOND)); calMin.set(Calendar.MILLISECOND, calMin.getMinimum(Calendar.MILLISECOND)); Calendar calMax = Calendar.getInstance(); calMax.setTime(chargeYear); calMax.set(Calendar.MONTH, calMax.getMaximum(Calendar.MONTH)); calMax.set(Calendar.DAY_OF_MONTH, calMax.getMaximum(Calendar.DAY_OF_MONTH)); calMax.set(Calendar.HOUR_OF_DAY, calMax.getMaximum(Calendar.HOUR_OF_DAY)); calMax.set(Calendar.MINUTE, calMax.getMaximum(Calendar.MINUTE)); calMax.set(Calendar.SECOND, calMax.getMaximum(Calendar.SECOND)); calMax.set(Calendar.MILLISECOND, calMax.getMaximum(Calendar.MILLISECOND)); calMin.add(Calendar.YEAR, -1); calMax.add(Calendar.YEAR, 1); HolidaySearch fiestaSearch = new HolidaySearch(); fiestaSearch.setStartDate(calMin.getTime()); fiestaSearch.setEndDate(calMax.getTime()); List<Holiday> listFiestas = fiestasManager.getAllEntities(fiestaSearch, null); calMin.setTime(chargeYear); calMin.set(Calendar.MONTH, calMin.getMinimum(Calendar.MONTH)); calMin.set(Calendar.DAY_OF_MONTH, calMin.getMinimum(Calendar.DAY_OF_MONTH)); calMin.set(Calendar.HOUR_OF_DAY, calMin.getMinimum(Calendar.HOUR_OF_DAY)); calMin.set(Calendar.MINUTE, calMin.getMinimum(Calendar.MINUTE)); calMin.set(Calendar.SECOND, calMin.getMinimum(Calendar.SECOND)); calMin.set(Calendar.MILLISECOND, calMin.getMinimum(Calendar.MILLISECOND)); calMax.setTime(chargeYear); calMax.set(Calendar.MONTH, calMax.getMaximum(Calendar.MONTH)); calMax.set(Calendar.DAY_OF_MONTH, calMax.getMaximum(Calendar.DAY_OF_MONTH)); calMax.set(Calendar.HOUR_OF_DAY, calMax.getMaximum(Calendar.HOUR_OF_DAY)); calMax.set(Calendar.MINUTE, calMax.getMaximum(Calendar.MINUTE)); calMax.set(Calendar.SECOND, calMax.getMaximum(Calendar.SECOND)); calMax.set(Calendar.MILLISECOND, calMax.getMaximum(Calendar.MILLISECOND)); RequestHolidayManager holyManager = RequestHolidayManager.getDefault(); RequestHolidaySearch holSearch = new RequestHolidaySearch(); holSearch.setUserRequest(uhs.getUser()); holSearch.setState(HolidayState.ACCEPT); holSearch.setStartChargeYear(calMin.getTime()); holSearch.setEndChargeYear(calMax.getTime()); List<RequestHoliday> listH = holyManager.getAllEntities(holSearch, null); for (RequestHoliday rH : listH) { Calendar cActual = Calendar.getInstance(); cActual.setTime(rH.getBeginDate()); while (!cActual.getTime().after(rH.getFinalDate())) { if (cActual.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && cActual.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) { boolean isFiesta = false; for (Holiday fiest : listFiestas) { Calendar cFiesta = Calendar.getInstance(); cFiesta.setTime(fiest.getDate()); if (cFiesta.get(Calendar.YEAR) == cActual.get(Calendar.YEAR) && cFiesta.get(Calendar.MONTH) == cActual.get(Calendar.MONTH) && cFiesta.get(Calendar.DAY_OF_MONTH) == cActual.get(Calendar.DAY_OF_MONTH)) { isFiesta = true; } } if (!isFiesta) { acceptedHolidays++; } } cActual.add(Calendar.DAY_OF_MONTH, 1); } } uhs.setTotalAccepted(acceptedHolidays); Calendar calAuxCont = Calendar.getInstance(); calAuxCont.setTime(uhs.getUser().getStartDate()); Calendar calAux = Calendar.getInstance(); calAux.setTime(chargeYear); int yearCharge = calAux.get(Calendar.YEAR); int yearContract = calAuxCont.get(Calendar.YEAR); if (yearCharge == yearContract) { // Dividimos los das de cada usuario entre los meses del ao. double ratio = uhs.getUser().getAgreement().getHolidays() / 12.0; int monthContract = calAuxCont.get(Calendar.MONTH); int meses = (Calendar.DECEMBER - monthContract); double diasVacaciones = meses * ratio; double aux = Math.ceil(diasVacaciones); uhs.setTotalYear((int) aux); } } return uhs; }
From source file:com.jeans.iservlet.controller.impl.AssetsController.java
private Map<String, Object> parseFilters(String filters) { Map<String, Object> ret = new HashMap<String, Object>(); String[] fs = filters.split("&"); Set<String> vendors = new HashSet<String>(); String[] vs = fs[0].split(","); for (String v : vs) { if (!StringUtils.isBlank(v)) { vendors.add(v);//from w w w.j a v a 2s. c o m } } ret.put("vendor", vendors); Calendar start = Calendar.getInstance(); try { start.set(Calendar.YEAR, Integer.parseInt(fs[1])); start.set(Calendar.MONTH, Calendar.JANUARY); start.set(Calendar.DATE, 1); start.set(Calendar.HOUR_OF_DAY, 0); start.set(Calendar.MINUTE, 0); start.set(Calendar.SECOND, 0); start.set(Calendar.MILLISECOND, 0); ret.put("purchaseTimeStart", start.getTime()); } catch (Exception e) { ret.put("purchaseTimeStart", null); } Calendar end = Calendar.getInstance(); try { end.set(Calendar.YEAR, Integer.parseInt(fs[2])); end.set(Calendar.MONTH, Calendar.DECEMBER); end.set(Calendar.DATE, 31); end.set(Calendar.HOUR_OF_DAY, 23); end.set(Calendar.MINUTE, 59); end.set(Calendar.SECOND, 59); end.set(Calendar.MILLISECOND, 999); ret.put("purchaseTimeEnd", end.getTime()); } catch (Exception e) { ret.put("purchaseTimeEnd", null); } try { ret.put("state", Byte.parseByte(fs[3])); } catch (Exception e) { ret.put("state", (byte) 9); } if (fs.length == 6) { // : warranty, importance try { ret.put("warranty", Byte.parseByte(fs[5])); } catch (Exception e) { ret.put("warranty", (byte) 9); } try { ret.put("importance", Byte.parseByte(fs[6])); } catch (Exception e) { ret.put("importance", (byte) 9); } } else if (fs.length == 5) { // : softwareType try { ret.put("softwareType", Byte.parseByte(fs[4])); } catch (Exception e) { ret.put("softwareType", (byte) 9); } } return ret; }
From source file:strat.mining.multipool.stats.service.impl.DonationServiceImpl.java
/** * Return the value of all transactions of the previous month. * // w w w .j a v a2s . c o m * @return */ private Float getLastMonthDonationsValue() { Calendar start = new GregorianCalendar(); start.add(Calendar.MONTH, -1); start.set(Calendar.DAY_OF_MONTH, 1); start.set(Calendar.HOUR, 0); start.set(Calendar.MINUTE, 0); start.set(Calendar.SECOND, 0); start.set(Calendar.MILLISECOND, 0); List<Transaction> transactions = donationTransactionDao.getTransactionsBetween(start.getTime(), getFirstDayOfMonthDate()); Float result = 0f; if (CollectionUtils.isNotEmpty(transactions)) { for (Transaction transaction : transactions) { result += transaction.getAmount(); } } return result; }
From source file:com.antsdb.saltedfish.server.mysql.util.BufferUtils.java
public static void writeTimestamp(ByteBuf buf, Timestamp date) { buf.writeByte(11);/*from ww w . j av a2 s .c o m*/ Calendar cal = Calendar.getInstance(); cal.setTime(date); BufferUtils.writeUB2(buf, cal.get(Calendar.YEAR)); buf.writeByte(cal.get(Calendar.MONTH) + 1); buf.writeByte(cal.get(Calendar.DAY_OF_MONTH)); buf.writeByte(cal.get(Calendar.HOUR_OF_DAY)); buf.writeByte(cal.get(Calendar.MINUTE)); buf.writeByte(cal.get(Calendar.SECOND)); BufferUtils.writeUB4(buf, cal.get(Calendar.MILLISECOND) * 1000); }