当前位置: 首页>>代码示例>>Java>>正文


Java DateUtils.format方法代码示例

本文整理汇总了Java中org.apache.tools.ant.util.DateUtils.format方法的典型用法代码示例。如果您正苦于以下问题:Java DateUtils.format方法的具体用法?Java DateUtils.format怎么用?Java DateUtils.format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tools.ant.util.DateUtils的用法示例。


在下文中一共展示了DateUtils.format方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import org.apache.tools.ant.util.DateUtils; //导入方法依赖的package包/类
public void run() {

        Calendar startDate = new GregorianCalendar();
        Calendar endDate = new GregorianCalendar();
        endDate.add(Calendar.DAY_OF_MONTH, futureDaysCount);

        ObecData obecData = new ObecData();
        String sDate = DateUtils.format(startDate.getTime(), "yyyy-MM-dd");
        String eDate = DateUtils.format(endDate.getTime(), "yyyy-MM-dd");
        String fileName = obecData.generateOBEC(sDate, eDate, properties);

        // send generated file to EDT service
        UploadData uploadData = toUpload(fileName);
        sendUploadData(uploadData);
    }
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:16,代码来源:OBECRunner.java

示例2: startTestSuite

import org.apache.tools.ant.util.DateUtils; //导入方法依赖的package包/类
/**
     * The whole testsuite started.
     * @param suite the testsuite.
     */
    public void startTestSuite(final JUnitTest suite) {
        doc = getDocumentBuilder().newDocument();
        rootElement = doc.createElement(TESTSUITE);
        String n = suite.getName();
//        if (n != null && !tag.isEmpty())
//            n = n + "-" + tag;
        rootElement.setAttribute(ATTR_NAME, n == null ? UNKNOWN : n);

        //add the timestamp
        final String timestamp = DateUtils.format(new Date(),
                DateUtils.ISO8601_DATETIME_PATTERN);
        rootElement.setAttribute(TIMESTAMP, timestamp);
        //and the hostname.
        rootElement.setAttribute(HOSTNAME, getHostname());

        // Output properties
        final Element propsElement = doc.createElement(PROPERTIES);
        rootElement.appendChild(propsElement);
        final Properties props = suite.getProperties();
        if (props != null) {
            final Enumeration e = props.propertyNames();
            while (e.hasMoreElements()) {
                final String name = (String) e.nextElement();
                final Element propElement = doc.createElement(PROPERTY);
                propElement.setAttribute(ATTR_NAME, name);
                propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
                propsElement.appendChild(propElement);
            }
        }
    }
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:35,代码来源:CassandraXMLJUnitResultFormatter.java

示例3: startTestSuite

import org.apache.tools.ant.util.DateUtils; //导入方法依赖的package包/类
/**
 * The whole testsuite started.
 * @param suite the testsuite.
 */
@Override
public void startTestSuite(final JUnitTest suite) {
    doc = getDocumentBuilder().newDocument();
    rootElement = doc.createElement(TESTSUITE);
    final String n = suite.getName();
    rootElement.setAttribute(ATTR_NAME, n == null ? UNKNOWN : n);

    //add the timestamp
    final String timestamp = DateUtils.format(new Date(),
            DateUtils.ISO8601_DATETIME_PATTERN);
    rootElement.setAttribute(TIMESTAMP, timestamp);
    //and the hostname.
    rootElement.setAttribute(HOSTNAME, getHostname());

    // Output properties
    final Element propsElement = doc.createElement(PROPERTIES);
    rootElement.appendChild(propsElement);
    final Properties props = suite.getProperties();
    if (props != null) {
        for (String name : props.stringPropertyNames()) {
            final Element propElement = doc.createElement(PROPERTY);
            propElement.setAttribute(ATTR_NAME, name);
            propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
            propsElement.appendChild(propElement);
        }
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:32,代码来源:XMLJUnitResultFormatter.java

示例4: setNotePermissions

import org.apache.tools.ant.util.DateUtils; //导入方法依赖的package包/类
public ActionForward setNotePermissions(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
	CaseManagementNoteDAO noteDao = (CaseManagementNoteDAO) SpringUtils.getBean("caseManagementNoteDAO");
	ProgramDao programDao = (ProgramDao) SpringUtils.getBean("programDao");
	SecroleDao secroleDao = (SecroleDao) SpringUtils.getBean("secroleDao");

	String noteId = request.getParameter("noteId");
	String newProgramNo = request.getParameter("program");
	String newRoleId = request.getParameter("role");

	HashMap<String, Object> hashMap = new HashMap<String, Object>();

	hashMap.put("noteId", noteId);

	LoggedInInfo loggedInInfo=LoggedInInfo.getLoggedInInfoFromSession(request);
	String providerNo=loggedInInfo.getLoggedInProviderNo();
	Provider provider = loggedInInfo.getLoggedInProvider();

	if (canNoteBeModified(providerNo, noteId)) {
		CaseManagementNote note = noteDao.getNote(Long.parseLong(noteId));


		// Are this note's permissions being changed after all?
		if (note.getReporter_caisi_role() != null && note.getReporter_caisi_role().equalsIgnoreCase(newRoleId)
				&& note.getProgram_no() != null && note.getProgram_no().equalsIgnoreCase(newProgramNo)) {
			hashMap.put("success", "NO_CHANGE");
		} else if (providerHasAccess(providerNo, newProgramNo, newRoleId, note.getDemographic_no())) {
			// Check if this provider has access to the requested program & role pair
			Program p = programDao.getProgram(Integer.parseInt(newProgramNo));
			Secrole r = secroleDao.getRole(Integer.parseInt(newRoleId));

			note.setProgram_no(newProgramNo);
			note.setReporter_caisi_role(newRoleId);
			Date newDate = new Date();
			note.setUpdate_date(newDate);

			String newNote = note.getNote();
			newNote += "\n[" + DateUtils.format(newDate, "yyyy-MM-dd") + " Program/role changed to: " + p.getName() + " (" + r.getName() + ") by " + provider.getLastName() + ", " + provider.getFirstName() + "]";
			note.setNote(newNote);

			Object id = noteDao.saveAndReturn(note);

			hashMap.put("success", "SAVED");
			hashMap.put("newProgramNo", newProgramNo);
			hashMap.put("newRoleId", newRoleId);
			hashMap.put("newProgramName", p.getName());
			hashMap.put("newRoleName", r.getName());
			hashMap.put("noteContent", newNote);
			hashMap.put("newNoteId", id);
		} else {
			// The provider making this modification won't be able to see the note if this change is made
			hashMap.put("error", "MAKES_INVISIBLE");
		}
	} else {
		// The provider doesn't have permission to see this note, so they can't modify it
		hashMap.put("error", "PERMISSION_DENIED");
	}

	JSONObject json = JSONObject.fromObject(hashMap);
	response.getOutputStream().write(json.toString().getBytes());

	return null;
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:63,代码来源:NotePermissionsAction.java

示例5: getCoordinate

import org.apache.tools.ant.util.DateUtils; //导入方法依赖的package包/类
private Coordinate<String, Number> getCoordinate(final EapEvent event, final EapEventType eventType) {
	return new Coordinate<String, Number>(DateUtils.format(event.getTimestamp(), "'Date.UTC('yyyy, M, d, h, m, s')'"), this.mappingTypeToInt.get(eventType));
}
 
开发者ID:bptlab,项目名称:Unicorn,代码行数:4,代码来源:EventViewOptions.java

示例6: setNotePermissions

import org.apache.tools.ant.util.DateUtils; //导入方法依赖的package包/类
public ActionForward setNotePermissions(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
	CaseManagementNoteDAO noteDao = (CaseManagementNoteDAO) SpringUtils.getBean("caseManagementNoteDAO");
	ProgramDao programDao = (ProgramDao) SpringUtils.getBean("programDao");
	SecroleDao secroleDao = (SecroleDao) SpringUtils.getBean("secroleDao");

	String noteId = request.getParameter("noteId");
	String newProgramNo = request.getParameter("program");
	String newRoleId = request.getParameter("role");

	HashMap<String, Object> hashMap = new HashMap<String, Object>();

	hashMap.put("noteId", noteId);

	Provider provider = LoggedInInfo.loggedInInfo.get().loggedInProvider;
	String providerNo = provider.getProviderNo();
	if (canNoteBeModified(providerNo, noteId)) {
		CaseManagementNote note = noteDao.getNote(Long.parseLong(noteId));


		// Are this note's permissions being changed after all?
		if (note.getReporter_caisi_role() != null && note.getReporter_caisi_role().equalsIgnoreCase(newRoleId)
				&& note.getProgram_no() != null && note.getProgram_no().equalsIgnoreCase(newProgramNo)) {
			hashMap.put("success", "NO_CHANGE");
		} else if (providerHasAccess(providerNo, newProgramNo, newRoleId, note.getDemographic_no())) {
			// Check if this provider has access to the requested program & role pair
			Program p = programDao.getProgram(Integer.parseInt(newProgramNo));
			Secrole r = secroleDao.getRole(Integer.parseInt(newRoleId));

			note.setProgram_no(newProgramNo);
			note.setReporter_caisi_role(newRoleId);
			Date newDate = new Date();
			note.setUpdate_date(newDate);

			String newNote = note.getNote();
			newNote += "\n[" + DateUtils.format(newDate, "yyyy-MM-dd") + " Program/role changed to: " + p.getName() + " (" + r.getName() + ") by " + provider.getLastName() + ", " + provider.getFirstName() + "]";
			note.setNote(newNote);

			Object id = noteDao.saveAndReturn(note);

			hashMap.put("success", "SAVED");
			hashMap.put("newProgramNo", newProgramNo);
			hashMap.put("newRoleId", newRoleId);
			hashMap.put("newProgramName", p.getName());
			hashMap.put("newRoleName", r.getName());
			hashMap.put("noteContent", newNote);
			hashMap.put("newNoteId", id);
		} else {
			// The provider making this modification won't be able to see the note if this change is made
			hashMap.put("error", "MAKES_INVISIBLE");
		}
	} else {
		// The provider doesn't have permission to see this note, so they can't modify it
		hashMap.put("error", "PERMISSION_DENIED");
	}

	JSONObject json = JSONObject.fromObject(hashMap);
	response.getOutputStream().write(json.toString().getBytes());

	return null;
}
 
开发者ID:oscarservice,项目名称:oscar-old,代码行数:61,代码来源:NotePermissionsAction.java


注:本文中的org.apache.tools.ant.util.DateUtils.format方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。