Welcome To The World Of Hacking


Learn Hacking|Teach Hacking|Learn To Secure|Learn To Code

Saturday

JAVA PROGRAMMING TUTORIAL 33 : CURRENT DATE USING SimpleDateFormat

import java.util.*;

import java.text.*;

public class HackDefence {

       public static void main(String args[]) {

             Date dateObject = new Date( );
   
            //E represents day in week
            //y represents year in 4 digit
            //M represents month in year
            //d represents day month
            //h represents hour
            //m represents minute in hour
            //s represents second minute
   
            SimpleDateFormat ft = new SimpleDateFormat ("E yyyy.MM.dd 'at' hh:mm:ss");

            System.out.println("Right now Date: " + ft.format(dateObject));
       
        }
   
}

OUTPUT:

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...