Friday, July 31, 2020

JAVA Code to get Date with Month and Time



                                GregorianCalendar  gc=new GregorianCalendar();
    gc.setTimeInMillis(System.currentTimeMillis());

    int day=gc.get(Calendar.DAY_OF_MONTH);
    int month=gc.get(Calendar.MONTH)+1;
    int year=gc.get(Calendar.YEAR);
    int hour = gc.get(Calendar.HOUR_OF_DAY);
                                int minute = gc.get(Calendar.MINUTE);
                         
    String date="Date: "+day+"/"+month+"/"+year+" Time : "+hour+":"+minute;
                               
                                System.out.print(date);

1 comment:

  1. Fantastic!! you are doing good job! I impressed. Many bodies are follow to you and try to some new.. After read your comments I feel; Its very interesting and every guys sahre with you own works. Great!!

    vé máy bay đi thái lan vietnam airlines

    bay từ tphcm đến singapore mất bao lâu

    giá vé máy bay đi kuala lumpur

    giá vé máy bay sang anh quốc

    đổi vé máy bay đi mỹ

    ReplyDelete