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 ... ?!
>>
>>
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
public static String getFormatDate(Date date) {
String formatDate = "";
try {
if (date != null) {
formatDate = (new
SimpleDateFormat("-MM-dd"))
.forma
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
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
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 ... ?!
6 matches
Mail list logo