Package Control

Examples of Control.DateFormatter


    Style headerStyle;

    try {

      String timeStarted = getDisplayedDate(dateChatStarted, true, false);
      DateFormatter formattedDate = new DateFormatter(dateChatStarted);

      styleDoc.insertString(styleDoc.getLength(), "Unterhaltung mit "
          + messages.get(0).getChatPartner().getDisplayedName() +" am "
          + formattedDate.getDay() + ". " + formattedDate.getMonthString()
          + " " + formattedDate.getYear() + " um "
          + timeStarted +" Uhr gestartet...", startInformationStyle);
      styleDoc.insertString(styleDoc.getLength(), "\n\n", biggerSpaceStyle);
      styleDoc.insertString(styleDoc.getLength(), "\n", littleSpaceStyle);

      for(Message message : messages){
View Full Code Here


   * <p>In case <code>returnTime</code> is <code>true</code> only the time gets returned</p>
   * <p>In case <code>completeDate</code> is <code>true</code> the whole date gets returned</p>
   */
  public String getDisplayedDate(Date messageDate, boolean returnTime, boolean completeDate){

    DateFormatter formattedDate = new DateFormatter(messageDate);

    String date = formattedDate.getHour() + ":" + formattedDate.getMinutes();

    if(returnTime){
      return date;
    }
    if( (! isToday(messageDate)) || completeDate){
      String date2 = formattedDate.getDay() + ". " + formattedDate.getMonthString()
      + " " + formattedDate.getYear() + " - ";

      date = date2 + date;
    }

    return date;
View Full Code Here

   *
   * @return <code>true</code> when the forwarded date is on the current day, <code>false</code> otherwise
   */
  private boolean isToday(Date date){

    DateFormatter today = new DateFormatter(new Date());
    DateFormatter forwarded = new DateFormatter(date);

    if(today.getYear() == forwarded.getYear() && today.getDay() == forwarded.getDay()
        && today.getMonth() == forwarded.getMonth()){
      return true;
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of Control.DateFormatter

Copyright © 2018 www.massapicom. 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.