Java-Date

Date

The date and time are encapsulate as objects inside the Date class. It allows date object to be accessed in a system independent manner. The toLocaleString( ) method returns a string representation of this date, using the locale conventions. The toGMTString( ) method returns a string representation of this date, using the Internet GMT conventions.

Program

0

Program Source

import java.util.Date;

public class Javaapp {

    public static void main(String[] args) {
        
        Date dat = new Date();
        System.out.println(dat);
        System.out.println(dat.toLocaleString());
        System.out.println(dat.toGMTString());
    }
}

Leave a Comment