Examples of SimpleDateFormat


Examples of java.text.SimpleDateFormat

     *
     * WARNING: "localdateandtime-offset" <br /> means: localdateandtime == GMT - offset
     * @see http://www.w3.org/TR/NOTE-datetime
     */
    public static Date fromDateTime(String dateAsString) throws ParseException {
        SimpleDateFormat df = new SimpleDateFormat(utcDateTimeFormatString);

        if (dateAsString.length() == 19)
            // without Z, assume UTC
            dateAsString += "+0000";
        else if (dateAsString.indexOf(':', 20) > -1)
            //xsd:dateTime
            //Java parser couldn't process hh:mm => copy to hhmm
            dateAsString = dateAsString.substring(0, 22) + dateAsString.substring(23);
        else if (dateAsString.indexOf('Z', 19) > -1)
            //xsd:dateTime
            //Java parser couldn't process the chars if they end with Z
            //-> no offset to UTC
            dateAsString = dateAsString.substring(0, 19) + "+0000";
        else if (dateAsString.length() < 19)
            throw new IllegalArgumentException(
                    "DateTime has to be in the following format:" + utcDateTimeFormatString);

        return df.parse(dateAsString);
    }
View Full Code Here

Examples of java.text.SimpleDateFormat

     * This method reads the specified string as date.
     * The info about the time zone will be neglected (e.g. -07:00).
     */
    public static Date fromLocalDateTime(String dateAsString)
            throws ParseException {
        SimpleDateFormat df = new SimpleDateFormat(localDateTimeFormatString);

        if (dateAsString.length() >= 19)
            dateAsString = dateAsString.substring(0, 19);

        return df.parse(dateAsString);
    }
View Full Code Here

Examples of java.text.SimpleDateFormat

     * This method returns a char from the specified date.
     *
     * @return string of Fdate in local time.
     */
    public static String toLocalDateTime(Date date) {
        return new SimpleDateFormat(localDateTimeFormatString).format(date);
    }
View Full Code Here

Examples of net.rim.device.api.i18n.SimpleDateFormat

    public boolean show() {
        return _dateTimePicker.doModal();
    }
   
    public Object getSelectedValue() {
        SimpleDateFormat sdf = new SimpleDateFormat( _HTML5Calendar.getFormat().toString() );
        StringBuffer sb = sdf.format( _dateTimePicker.getDateTime(), new StringBuffer(16), null );
       
        return sb.toString();
    }
View Full Code Here

Examples of org.gwtwidgets.client.util.SimpleDateFormat

  }

  private void testDateFormat3() {
    String sformat = "dd/MM/yyyy HH:mm:ss";
    GWT.log(sformat, null);
    SimpleDateFormat format = new SimpleDateFormat("EEEE dd-MM-yyyy HH:mm:ss");
    SimpleDateParser parser = new SimpleDateParser(sformat);
    Date date = parser.parse("05/10/1977 12:45:31");
    String text = format.format(date);
    _assert("Wednesday 05-10-1977 12:45:31".equals(text));
  }
View Full Code Here

Examples of org.jboss.bpm.console.client.model.util.SimpleDateFormat

   */
  public String render(Object value, CellMetadata cellMetadata, Record record,
                       int rowIndex, int colNum, Store store)
  {
    String s = "";
    SimpleDateFormat df = new SimpleDateFormat();
    Date d = record.getAsDate(fieldName);
    if (d != null)
      s = df.format(d);

    return s;
  }
View Full Code Here

Examples of org.jboss.bpm.console.client.util.SimpleDateFormat

  {
    Date result = null;
    String value = get(key);
    if(!isNull(value))
    {
      SimpleDateFormat df = new SimpleDateFormat();
      result = df.parse(value);
    }
   
    return result;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.