Decimal Format

Posted by veli on Mar 25 2008 | Java

Aşağıdaki örnek ile double tipindeki bir ifade formatlanabilir.

double toplam_fiyat = 155.548;
DecimalFormat df = new DecimalFormat(”#0.00“);
String formatted = df.format(toplam_fiyat);
//155.55

no comments for now

Java’da Formatlı Tarih Çıktısı

Posted by veli on Mar 25 2008 | Java

Şimdiki zamanı saat ve dakika olarak verir.

Date now = new Date();
int st = now.getHours();
int dk = now.getMinutes();
String simdi_saat = “”;
simdi_saat = String.valueOf(st)+”:“+String.valueOf(dk);

Devamını Oku »

no comments for now