Re: [JUG-Indonesia] Format String

2008-10-13 Terurut Topik Jecki
2008/10/13 irfani YangBaikHati <[EMAIL PROTECTED]>: > saiful_haqqi wrote: >> kalo di PHP ada fungsi seperti ini >> >> $thn = 2008; >> $bln = 9; >> $tgl = 1; >> $hasil = sprintf ("%04d-%02d-%02d", $tahun, $bulan, $tanggal); >> >> output: $hasil -> 2008-09-01 >> >> kalo di java gmn yach ... ?! >> >>

Re: [JUG-Indonesia] Format String

2008-10-13 Terurut Topik Jonathan Handoyo
System.out.println( new DecimalFormat("").format(new Long(thn)) + "-" + new DecimalFormat("00").format(new Long(bln)) + "-" + new DecimalFormat("00").format(new Long(tgl))); asumsi: thn, bln, tgl, semua nya long... hahahaha 2008/10/13 saiful_haqqi <[EMAIL PROTECTED]> > kalo di

Re: [JUG-Indonesia] Format String

2008-10-13 Terurut Topik kriegayo
public static String getFormatDate(Date date) { String formatDate = ""; try { if (date != null) { formatDate = (new SimpleDateFormat("-MM-dd")) .forma

Re: [JUG-Indonesia] Format String

2008-10-13 Terurut Topik Yogi Eka Hardiprasetyo
String newStr = "2008-09-10 23:10:00"; SimpleDateFormat sdf = new SimpleDateFormat("-MM-dd HH:mm:ss"); java.util.Date DATE = new Date(); try { DATE = (java.util.Date) sdf.parse(newStr); } catch (ParseException ex) { Logger.getLogger(processor.class.getName()).log(Level.SE

Re: [JUG-Indonesia] Format String

2008-10-13 Terurut Topik irfani YangBaikHati
saiful_haqqi wrote: > kalo di PHP ada fungsi seperti ini > > $thn = 2008; > $bln = 9; > $tgl = 1; > $hasil = sprintf ("%04d-%02d-%02d", $tahun, $bulan, $tanggal); > > output: $hasil -> 2008-09-01 > > kalo di java gmn yach ... ?! > > > -Formatter class -String.format -- irfani http://irfani.we

[JUG-Indonesia] Format String

2008-10-13 Terurut Topik saiful_haqqi
kalo di PHP ada fungsi seperti ini $thn = 2008; $bln = 9; $tgl = 1; $hasil = sprintf ("%04d-%02d-%02d", $tahun, $bulan, $tanggal); output: $hasil -> 2008-09-01 kalo di java gmn yach ... ?!