|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
help me to understand java code (calendar java code) ?
hi i need some one explain java code (calendar java code) i study java now .... and i hava final lap exam tomoroow this is my code PHP Code: |
#2
| |||
| |||
Re: help me to understand java code (calendar java code) ?
The main purpose of Calendar is to represent the GMT in various Calendars , various TimeZones. By default Gegorian Calendar is being used all over the world. Please follow the below snippet to understand ————————————————- System.out.println(“________________________All about Calendar Classes________________________________________”); //By default it will get the Gegorian Calendar and intialize with the current datetime related to the default timezone in which you are Calendar c2 = Calendar.getInstance(); System.out.println(c2.getTimeZone().getDisplayName()); System.out.println(c2.get(Calendar.HOUR)); System.out.println(c2.get(Calendar.MINUTE)); System.out.println(“c2 =”+c2.getTimeInMillis()); //Using Calendar Object to Convert date from one TimeZone to another TimeZone Calendar c3 = Calendar.getInstance(TimeZone.getTimeZone(“America/Los_Angeles”)); c3.setTimeInMillis(c2.getTimeInMillis()); System.out.println(c3.getTimeZone().getDisplayName()); System.out.println(c3.get(Calendar.HOUR)); System.out.println(c3.get(Calendar.MINUTE)); System.out.println(“c3 =”+c3.getTimeInMillis()); Locale ——– One of the Locale Object Constructor is Locale(language,Country); Locale is used to capture the Locality information of where the user is being present. new Locale(‘en’,'IN’) //represents the Locale object intialized with the India Locality. there is default locale object which is being intialized at the start of the JVM. This locale object is being used when displaying the local sensitive information such as date and others. new SimpleDateFormat(“pattern”,new Locale(language,CountryCode)); the above format is being used to display the date in the pattern which was given in the constructor while displaying this SimpleDateFormat also considers the Locale Object too to display the same pattern as per the taste of local people. Code snippet ————— Date d = new Date(); //created the date object SimpleDateFormat sdf = new SimpleDateFormat(“yyyy.MM.dd G ‘at’ HH:mm:ss Z”,l2); System.out.println(“In the present Time Zone”); System.out.println(sdf.format(d));
__________________ Education, Career and Job Discussions |
#3
| |||
| |||
Re: help me to understand java code (calendar java code) ?
thank you for help but if you can explain this : HTML Code: import javax.swing.*; import java.util.*; import java.text.*; PHP Code: |
![]() |
|
Tags: calendar, code, java, java code |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
pls convert this c++ to java code | xSim21 | Software Development | 4 | 26-03-2012 06:32 PM |
help with java code | unikshegz | Software Development | 2 | 24-10-2010 02:47 PM |
Use Java code in PHP | Gajendra1 | Software Development | 6 | 12-08-2010 10:18 AM |
Java error in I/O Code | Viensterrr | Software Development | 5 | 18-01-2010 05:03 PM |
Java code for button | Owen Fernandes | Software Development | 5 | 06-01-2010 02:39 PM |