General.java :  » GWT » g-mvc » com » mclub » client » util » Java Open Source

Java Open Source » GWT » g mvc 
g mvc » com » mclub » client » util » General.java
/*
 * Copyleft 2010 Mustafa DUMLUPINAR
 *
 * Distributable under GPL license.
 * See terms of license at gnu.org.
 * http://www.gnu.org/licenses/gpl.html
 *
 * dumlupinar01@gmail.com
 * http://mdpinar.blogspot.com/
 *
 */
package com.mclub.client.util;

import java.util.Date;

import com.google.gwt.i18n.client.DateTimeFormat;

/**
 * Genel yardimci metodlari sunan siniftir
 * 
 * @author mdpinar
 * 
 */
public class General {

  /**
   * Verilen tarihi yyyy-MM-dd formatinda String olarak doner
   * 
   * @param date
   * 
   * @return String farmatli tarih
   */
  public static String formatDate(Date date) {
    return formatDate(date, "yyyy-MM-dd");
  }
  
  /**
   * Verilen tarihi verilen formatda String olarak doner
   * 
   * @param date
   * @param format
   * 
   * @return String formatli tarih
   */
  public static String formatDate(Date date, String format) {
    return DateTimeFormat.getFormat(format).format(date);
  }

  /**
   * Verilen sayinin son iki hanesini yuvarlar
   * 
   * @param value
   * 
   * @return double yuvarlanmis sayi
   */
  public static double roundTwoDecimals(double value) {
    int ix = (int) (value * 100.0);
    return ((double) ix) / 100.0;
  }
  
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.