Click here to watch on Youtube:
https://www.youtube.com/watch?v=Ey34imHz2es&list=UUhwKlOVR041tngjerWxVccw
GregorianCalendarDemo1.java
Output
GregorianCalendarDemo2.java
Output
GregorianCalendarDemo3.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/GregorianCalendarDemo_Cons_locale_timezone.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/GregorianCalendarDemo_Cons_locale_timezone
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/9517738654fc960a41fe7bd750435376eb3e2064/BasicJava_2018/GregorianCalendarDemo_Cons_locale_timezone/?at=master
See also:
All JavaEE Videos Playlist
All JavaEE Videos
All JAVA EE Links
Spring Tutorial
Servlets Tutorial
All Design Patterns Links
JDBC Tutorial
Java Collection Framework Tutorial
JAVA Tutorial
Kids Tutorial
Cooking Tutorial
https://www.youtube.com/watch?v=Ey34imHz2es&list=UUhwKlOVR041tngjerWxVccw
GregorianCalendarDemo1.java
import java.util.GregorianCalendar;
import java.util.Locale;
public class GregorianCalendarDemo1
{
public static void main(String[] args)
{
Locale locale = Locale.getDefault();
System.out.println("locale = "+locale);
/*
* Parameters:
*
* aLocale - the given locale.
*/
GregorianCalendar cal = new GregorianCalendar(locale);
System.out.println(cal.getTime());
}
}
import java.util.Locale;
public class GregorianCalendarDemo1
{
public static void main(String[] args)
{
Locale locale = Locale.getDefault();
System.out.println("locale = "+locale);
/*
* Parameters:
*
* aLocale - the given locale.
*/
GregorianCalendar cal = new GregorianCalendar(locale);
System.out.println(cal.getTime());
}
}
Output
locale = en_US
Thu Aug 09 09:31:15 IST 2018
Thu Aug 09 09:31:15 IST 2018
GregorianCalendarDemo2.java
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class GregorianCalendarDemo2
{
public static void main(String[] args)
{
TimeZone timeZone = TimeZone.getDefault();
System.out.println("timeZone = "+timeZone);
/*
* Parameters:
*
* zone - the given time zone.
*/
GregorianCalendar cal = new GregorianCalendar(timeZone);
System.out.println(cal.getTime());
}
}
import java.util.TimeZone;
public class GregorianCalendarDemo2
{
public static void main(String[] args)
{
TimeZone timeZone = TimeZone.getDefault();
System.out.println("timeZone = "+timeZone);
/*
* Parameters:
*
* zone - the given time zone.
*/
GregorianCalendar cal = new GregorianCalendar(timeZone);
System.out.println(cal.getTime());
}
}
Output
timeZone = sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null]
Thu Aug 09 09:31:23 IST 2018
Thu Aug 09 09:31:23 IST 2018
GregorianCalendarDemo3.java
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;
public class GregorianCalendarDemo3
{
public static void main(String[] args)
{
TimeZone timeZone = TimeZone.getDefault();
System.out.println("timeZone = "+timeZone);
Locale locale = Locale.getDefault();
System.out.println("locale = "+locale);
/*
* Parameters:
*
* zone - the given time zone.
* aLocale - the given locale.
*/
GregorianCalendar cal = new GregorianCalendar(timeZone,locale);
System.out.println(cal.getTime());
}
}
import java.util.Locale;
import java.util.TimeZone;
public class GregorianCalendarDemo3
{
public static void main(String[] args)
{
TimeZone timeZone = TimeZone.getDefault();
System.out.println("timeZone = "+timeZone);
Locale locale = Locale.getDefault();
System.out.println("locale = "+locale);
/*
* Parameters:
*
* zone - the given time zone.
* aLocale - the given locale.
*/
GregorianCalendar cal = new GregorianCalendar(timeZone,locale);
System.out.println(cal.getTime());
}
}
Output
timeZone = sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null]
locale = en_US
Thu Aug 09 09:31:32 IST 2018
locale = en_US
Thu Aug 09 09:31:32 IST 2018
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/GregorianCalendarDemo_Cons_locale_timezone.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/GregorianCalendarDemo_Cons_locale_timezone
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/9517738654fc960a41fe7bd750435376eb3e2064/BasicJava_2018/GregorianCalendarDemo_Cons_locale_timezone/?at=master
See also:
No comments:
Post a Comment