Pages

Dokumentasi insert date from date.util to mysql


 public String setDate(String date) {
        String tg = "";
        String tgl[] = date.split("-");

      
        if (tgl[1].equals("Jan")) {
            tg = tgl[0] + "-" + "01"+ "-" + tgl[2];
        } else if (tgl[1].equals("Feb")) {
           tg = tgl[0] + "-" + "02"+ "-" + tgl[2];
        } else if (tgl[1].equals("Mar")) {
            tg = tgl[0] + "-" + "03"+ "-" + tgl[2];
        }else if (tgl[1].equals("Apr")) {
            tg = tgl[0] + "-" + "04"+ "-" + tgl[2];
        }else if (tgl[1].equals("Mei")) {
            tg = tgl[0] + "-" + "05"+ "-" + tgl[2];
        }else if (tgl[1].equals("Jun")) {
            tg = tgl[0] + "-" + "06"+ "-" + tgl[2];
        }else if (tgl[1].equals("Jul")) {
            tg = tgl[0] + "-" + "07"+ "-" + tgl[2];
        }else if (tgl[1].equals("Agu")) {
            tg = tgl[0] + "-" + "08"+ "-" + tgl[2];
        }else if (tgl[1].equals("Sep")) {
            tg = tgl[0] + "-" + "09"+ "-" + tgl[2];
        }else if (tgl[1].equals("Okt")) {
            tg = tgl[0] + "-" + "10"+ "-" + tgl[2];
        }else if (tgl[1].equals("Nov")) {
            tg = tgl[0] + "-" + "11"+ "-" + tgl[2];
        }else{
        tg = tgl[0] + "-" + "12"+ "-" + tgl[2];
        }
        return tg;
    }

0 comments:

Posting Komentar