Example usage for java.util Date toString

List of usage examples for java.util Date toString

Introduction

In this page you can find the example usage for java.util Date toString.

Prototype

public String toString() 

Source Link

Document

Converts this Date object to a String of the form:
 dow mon dd hh:mm:ss zzz yyyy
where:
  • dow is the day of the week ( Sun, Mon, Tue, Wed, Thu, Fri, Sat ).

    Usage

    From source file:com.skilrock.lms.embedded.roleMgmt.common.PrivsInterceptor.java

    public boolean isSaleDuration(UserInfoBean userInfoBean) {
        Date d = new Date();
        ServletContext sc = ServletActionContext.getServletContext();
        if (d.toString().split(" ")[3].compareTo((String) sc.getAttribute("SALE_START_TIME")) >= 0
                && d.toString().split(" ")[3].compareTo((String) sc.getAttribute("SALE_END_TIME")) <= 0) {
            return true;
        }/*  ww  w  . j av a 2  s  .c o m*/
        return false;
    }
    

    From source file:org.openbravo.erpCommon.info.PriceListVersionFilterExpressionName.java

    private Date getDate() {
        Date date = parseDate(requestMap.get("inpDate"));
        if (date != null) {
            log.debug("Return date ordered from request." + date.toString());
            return date;
        }/*from   w  ww  .jav  a 2 s  .c  o  m*/
        date = parseDate((String) httpSession.getAttribute(windowId + "|" + "DATEORDERED"));
        if (date != null) {
            log.debug("Return date ordered from window's session: " + date.toString());
            return date;
        }
        date = parseDate((String) httpSession.getAttribute(windowId + "|" + "DATEINVOICED"));
        if (date != null) {
            log.debug("Return date invoiced from window's session: " + date.toString());
            return date;
        }
        return DateUtils.truncate(new Date(), Calendar.DATE);
    }
    

    From source file:com.hihframework.core.utils.DateUtils.java

    /**
     * java.sql.Date?java.sql.Timestamp "00:00:00.000"
     *
     * @param date java.sql.Date ??Date/* www .  j av  a 2  s. co m*/
     * @return java.sql.Timestamp ??Timestamp
     */
    public static Timestamp convertDateToTimestampMin(java.sql.Date date) {
        return Timestamp.valueOf(date.toString() + " 00:00:00.000");
    }
    

    From source file:com.hihframework.core.utils.DateUtils.java

    /**
     * java.sql.Date?java.sql.Timestamp "23:59:59.999"
     *
     * @param date java.sql.Date ??Date/*from  ww  w  .j  ava 2s .  c om*/
     * @return java.sql.Timestamp ??Timestamp
     */
    public static Timestamp convertDateToTimestampMax(java.sql.Date date) {
        return Timestamp.valueOf(date.toString() + " 23:59:59.999");
    }
    

    From source file:edu.pitt.resumecore.Prescription.java

    /**
     * @param prescriptionDate the prescriptionDate to set
     *//*from  w ww . ja v a2 s .co  m*/
    public void setPrescriptionDate(Date prescriptionDate) {
        String sql = "UPDATE emr.prescriptions SET prescriptionDate = '"
                + StringUtilities.cleanMySqlInsert(prescriptionDate.toString()) + "' ";
        sql += "WHERE prescriptionDate = '" + this.prescriptionDate + "';";
        db.executeQuery(sql);
    
        this.prescriptionDate = prescriptionDate;
    }
    

    From source file:edu.pdx.konstan2.PortlandLive.ArrivalsFactory.java

    public String asString() {
        Date scheduled = new Date(this.scheduled);
        Date estimated;//from   w w w.  ja  v  a  2 s.c  o m
        if (this.estimated != null) {
            estimated = new Date(this.estimated);
            return shortSign + " " + scheduled.toString() + " estimated at " + estimated.toString();
        } else {
            return shortSign + " " + scheduled.toString();
        }
    }
    

    From source file:nl.knaw.dans.dccd.oai.DCCDOAIDriver.java

    @Override
    public RemoteIterator<? extends Record> listRecords(Date from, Date until, String mdPrefix)
            throws RepositoryException {
        LOG.debug("listRecords: " + from.toString() + ", " + until.toString() + ", " + mdPrefix);
    
        return new RemoteIteratorImpl<Record>(getRecordCollection(from, until, mdPrefix).iterator());
    }
    

    From source file:it.reexon.lib.gpx.runtastic.parser.GpxRuntasticParser.java

    private void analyzesMetadataNode(Node node) throws DOMException, URISyntaxException {
        MetadataType metadataType = new MetadataType();
        if (node.getNodeType() == Node.ELEMENT_NODE) {
            Element metadataElement = (Element) node;
    
            // ---------------------------- Copyright ----------------------------
            NodeList copyright = metadataElement.getElementsByTagName("copyright");
            CopyrightType copyrightType = new CopyrightType();
            if (copyright.getLength() == 1) {
                Node copyrightNode = copyright.item(0);
                copyrightType.setAuthor(copyrightNode.getAttributes().getNamedItem("author").getNodeValue());
            }/*from  ww w .ja  v  a  2s .  com*/
            Year year = Year.of(
                    new Integer(metadataElement.getElementsByTagName("year").item(0).getTextContent()).intValue());
            URI licence = new URI(metadataElement.getElementsByTagName("license").item(0).getTextContent());
    
            System.out.println("Year: " + year.toString());
            System.out.println("License: " + licence.toString());
    
            // ---------------------------- Link ----------------------------
            NodeList link = metadataElement.getElementsByTagName("link");
            LinkType linkType = new LinkType();
            if (link.getLength() == 1) {
                Node linkNode = link.item(0);
                linkType.setAnyURI(new URI(linkNode.getAttributes().getNamedItem("href").getNodeValue()));
            }
            String text = metadataElement.getElementsByTagName("text").item(0).getTextContent();
            linkType.setText(text);
            System.out.println("Text: " + text);
            Date time = new DateTime(metadataElement.getElementsByTagName("time").item(0).getTextContent())
                    .toDate();
            System.out.println("Time: " + time.toString());
    
            copyrightType.setYear(year);
            copyrightType.setLicence(licence);
            metadataType.setCopyright(copyrightType);
            metadataType.setTime(time);
    
            gpx.setMetadata(metadataType);
        }
    }
    

    From source file:org.artifactory.webapp.wicket.page.security.user.UserModel.java

    public String getLastAccessString() {
        if (isAnonymous() || (lastAccessTimeMillis == 0)) {
            return "N/A";
        }//from  w  w  w  . ja va2s .c om
        PrettyTime prettyTime = new PrettyTime();
        Date lastAccessDate = new Date(lastAccessTimeMillis);
        return prettyTime.format(lastAccessDate) + " (" + lastAccessDate.toString() + ")";
    }
    

    From source file:com.jaeksoft.searchlib.parser.PdfParser.java

    private String getDate(Calendar cal) {
        if (cal == null)
            return null;
        Date time = cal.getTime();
        if (time == null)
            return null;
        return time.toString();
    }