🗊Презентация 3. Essential Java Classes 3. Date and Time

Нажмите для полного просмотра!
3. Essential Java Classes 3. Date and Time, слайд №13. Essential Java Classes 3. Date and Time, слайд №23. Essential Java Classes 3. Date and Time, слайд №33. Essential Java Classes 3. Date and Time, слайд №43. Essential Java Classes 3. Date and Time, слайд №53. Essential Java Classes 3. Date and Time, слайд №63. Essential Java Classes 3. Date and Time, слайд №73. Essential Java Classes 3. Date and Time, слайд №83. Essential Java Classes 3. Date and Time, слайд №93. Essential Java Classes 3. Date and Time, слайд №103. Essential Java Classes 3. Date and Time, слайд №113. Essential Java Classes 3. Date and Time, слайд №123. Essential Java Classes 3. Date and Time, слайд №133. Essential Java Classes 3. Date and Time, слайд №143. Essential Java Classes 3. Date and Time, слайд №153. Essential Java Classes 3. Date and Time, слайд №163. Essential Java Classes 3. Date and Time, слайд №173. Essential Java Classes 3. Date and Time, слайд №183. Essential Java Classes 3. Date and Time, слайд №193. Essential Java Classes 3. Date and Time, слайд №203. Essential Java Classes 3. Date and Time, слайд №21

Вы можете ознакомиться и скачать презентацию на тему 3. Essential Java Classes 3. Date and Time. Доклад-сообщение содержит 21 слайдов. Презентации для любого класса можно скачать бесплатно. Если материал и наш сайт презентаций Mypresentation Вам понравились – поделитесь им с друзьями с помощью социальных кнопок и добавьте в закладки в своем браузере.

Слайды и текст этой презентации


Слайд 1





3. Essential Java Classes 
3. Date and Time
Описание слайда:
3. Essential Java Classes 3. Date and Time

Слайд 2





Date and Time Classes
Date - represents a specific instant in time, with millisecond precision 
GregorianCalendar (concrete subclass of Calendar) – date and time manipulations
SimpleDateFormat- formatting and parsing dates in a locale-sensitive manner 
Locale - represents a specific geographical, political, or cultural region
SimpleTimeZone(concrete subclass of TimeZone) - represents a time zone for use with a Gregorian calendar
Описание слайда:
Date and Time Classes Date - represents a specific instant in time, with millisecond precision GregorianCalendar (concrete subclass of Calendar) – date and time manipulations SimpleDateFormat- formatting and parsing dates in a locale-sensitive manner Locale - represents a specific geographical, political, or cultural region SimpleTimeZone(concrete subclass of TimeZone) - represents a time zone for use with a Gregorian calendar

Слайд 3





Class Date
represents a specific instant in time, with millisecond precision
new Date() returns current date and time
Date saves the milliseconds since January 1, 1970, 00:00:00
Date does not localized. Most of it methods are deprecated.
Calendar class allows to process dates
Описание слайда:
Class Date represents a specific instant in time, with millisecond precision new Date() returns current date and time Date saves the milliseconds since January 1, 1970, 00:00:00 Date does not localized. Most of it methods are deprecated. Calendar class allows to process dates

Слайд 4





Some Date methods
equals(Object obj)  - compares dates
after(Date date) - compares dates
before(Date date) - compares dates
getTime() – returns milliseconds since 01.01.1970
setTime() – sets date and time
See http://docs.oracle.com/javase/7/docs/api/java/util/Date.html for details
Описание слайда:
Some Date methods equals(Object obj) - compares dates after(Date date) - compares dates before(Date date) - compares dates getTime() – returns milliseconds since 01.01.1970 setTime() – sets date and time See http://docs.oracle.com/javase/7/docs/api/java/util/Date.html for details

Слайд 5





Class Calendar
Abstract class that provides methods for converting between a specific instant in time and a set of calendar fields
Some calendar fields: YEAR, MONTH, DATE, DAY_OF_WEEK, HOUR_OF_DAY, MINUTE, SECOND, MILLISECOND
Описание слайда:
Class Calendar Abstract class that provides methods for converting between a specific instant in time and a set of calendar fields Some calendar fields: YEAR, MONTH, DATE, DAY_OF_WEEK, HOUR_OF_DAY, MINUTE, SECOND, MILLISECOND

Слайд 6





Calendar Methods
Calendar rightNow = Calendar.getInstance(); - gets current date and time
set(int field, int value) – sets calendar field value (then one of get (), getTime(), add(), roll() methods is needed)
add(int field, int amount) – adds given amount to the field
get(int field) – gets a given field value
See http://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html for details
Описание слайда:
Calendar Methods Calendar rightNow = Calendar.getInstance(); - gets current date and time set(int field, int value) – sets calendar field value (then one of get (), getTime(), add(), roll() methods is needed) add(int field, int amount) – adds given amount to the field get(int field) – gets a given field value See http://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html for details

Слайд 7





Class GregorianCalendar
Concrete subclass of Calendar 
Provides the standard calendar system used by most of the world.
Use GregorianCalendar for date and time manipulations
See http://docs.oracle.com/javase/7/docs/api/java/util/GregorianCalendar.html for details
Описание слайда:
Class GregorianCalendar Concrete subclass of Calendar Provides the standard calendar system used by most of the world. Use GregorianCalendar for date and time manipulations See http://docs.oracle.com/javase/7/docs/api/java/util/GregorianCalendar.html for details

Слайд 8





Calendar Examples
Задание даты:
GregorianCalendar calendar = new GregorianCalendar(2012, Calendar.May, 14);
Добавление к дате двух недель:
calendar.add(Calendar.WEEK_OF_YEAR, 2);
Изменение полей даты:
calendar.set(Calendar.DAY_OF_MONTH, 10);
calendar.set(Calendar.MONTH, Calendar.SEPTEMBER);
System.out.println(dtFrm.format(calendar.getTime()));
Описание слайда:
Calendar Examples Задание даты: GregorianCalendar calendar = new GregorianCalendar(2012, Calendar.May, 14); Добавление к дате двух недель: calendar.add(Calendar.WEEK_OF_YEAR, 2); Изменение полей даты: calendar.set(Calendar.DAY_OF_MONTH, 10); calendar.set(Calendar.MONTH, Calendar.SEPTEMBER); System.out.println(dtFrm.format(calendar.getTime()));

Слайд 9





Date & Calendar Transformations
Calendar c = Calendar.getInstance();
Date dt = new Date();
Calendar -> Date
		dt = c.getTime();
Date -> Calendar
		c.setTime(dt);
Описание слайда:
Date & Calendar Transformations Calendar c = Calendar.getInstance(); Date dt = new Date(); Calendar -> Date dt = c.getTime(); Date -> Calendar c.setTime(dt);

Слайд 10





Class SimpleDateFormat
is a concrete class for formatting and parsing dates in a locale-sensitive manner
It allows for: 
formatting (date -> text) 
parsing (text -> date) 
See http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html for details
Описание слайда:
Class SimpleDateFormat is a concrete class for formatting and parsing dates in a locale-sensitive manner It allows for: formatting (date -> text) parsing (text -> date) See http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html for details

Слайд 11





SimpleDateFormat Example
SimpleDateFormat dtFrm = 
			new SimpleDateFormat("dd.MM.yyyy"); 
Date start = new Date();
String txDate = dtFrm.format(start);
Описание слайда:
SimpleDateFormat Example SimpleDateFormat dtFrm = new SimpleDateFormat("dd.MM.yyyy"); Date start = new Date(); String txDate = dtFrm.format(start);

Слайд 12





Class Locale
represents a specific geographical, political, or cultural region
Locale lc = new Locale(”uk”, ”UK”);
Locale.getDefault() - gets the current value of the default locale
See http://docs.oracle.com/javase/7/docs/api/java/util/Locale.html for details
Описание слайда:
Class Locale represents a specific geographical, political, or cultural region Locale lc = new Locale(”uk”, ”UK”); Locale.getDefault() - gets the current value of the default locale See http://docs.oracle.com/javase/7/docs/api/java/util/Locale.html for details

Слайд 13





Класс SimpleTimeZone
A concrete subclass of TimeZone class that represents a time zone for use with a Gregorian calendar
Can specify the year when the daylight saving time schedule starts or ends.
See http://docs.oracle.com/javase/7/docs/api/java/util/SimpleTimeZone.html for details
Описание слайда:
Класс SimpleTimeZone A concrete subclass of TimeZone class that represents a time zone for use with a Gregorian calendar Can specify the year when the daylight saving time schedule starts or ends. See http://docs.oracle.com/javase/7/docs/api/java/util/SimpleTimeZone.html for details

Слайд 14





SimpleDateFormat Localization
SimpleDateFormat dtFrmL = new   
       SimpleDateFormat("dd.MMMM.yyyy", Locale.ENGLISH);
Date dt = new Date();
System.out.println("Locale.ENGLISH: " + dtFrmL.format(dt));

Locale.ENGLISH: 05.October.2013
Locale.GERMAN: 05.Oktober.2013
Locale.FRANCE: 05.octobre.2013
Locale.ITALIAN: 05.ottobre.2013
Locale("ua", "ua"): 05.October.2013
Locale("ru", "ru"): 05.Октябрь.2013
Описание слайда:
SimpleDateFormat Localization SimpleDateFormat dtFrmL = new SimpleDateFormat("dd.MMMM.yyyy", Locale.ENGLISH); Date dt = new Date(); System.out.println("Locale.ENGLISH: " + dtFrmL.format(dt)); Locale.ENGLISH: 05.October.2013 Locale.GERMAN: 05.Oktober.2013 Locale.FRANCE: 05.octobre.2013 Locale.ITALIAN: 05.ottobre.2013 Locale("ua", "ua"): 05.October.2013 Locale("ru", "ru"): 05.Октябрь.2013

Слайд 15





DateFormat Localization
DateFormat dtFrmD = DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.ENGLISH);
System.out.println("Locale.ENGLISH: " + dtFrmD.format(dt));

Locale.ENGLISH: Oct 5, 2013
Locale.GERMAN: 05.10.2013
Locale.FRANCE: 5 oct. 2013
Locale.ITALIAN: 5-ott-2013
Locale("ua", "ua"): Saturday, October 5, 2013
Locale("ru", "ru"): 5 Октябрь 2013 г.
Описание слайда:
DateFormat Localization DateFormat dtFrmD = DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.ENGLISH); System.out.println("Locale.ENGLISH: " + dtFrmD.format(dt)); Locale.ENGLISH: Oct 5, 2013 Locale.GERMAN: 05.10.2013 Locale.FRANCE: 5 oct. 2013 Locale.ITALIAN: 5-ott-2013 Locale("ua", "ua"): Saturday, October 5, 2013 Locale("ru", "ru"): 5 Октябрь 2013 г.

Слайд 16





Date Localization
http://docs.oracle.com/javase/tutorial/i18n/format/dateFormat.html
Описание слайда:
Date Localization http://docs.oracle.com/javase/tutorial/i18n/format/dateFormat.html

Слайд 17





Exercise 3.3.1
Print the following:
Current date
Date in 6 weeks 
Date 4 month before
Date in 45 days
Описание слайда:
Exercise 3.3.1 Print the following: Current date Date in 6 weeks Date 4 month before Date in 45 days

Слайд 18





Exercise 3.3.1
See 331DateActions project for the full text
Описание слайда:
Exercise 3.3.1 See 331DateActions project for the full text

Слайд 19





Exercise 3.3.2. 
Create a static method that gets some date and returns next bank day
Описание слайда:
Exercise 3.3.2. Create a static method that gets some date and returns next bank day

Слайд 20





Exercise 3.3.2. 
See 332NextBankDay project for full text
Описание слайда:
Exercise 3.3.2. See 332NextBankDay project for full text

Слайд 21





Exercise 3.3.3.
Create a method that gets two dates and returns number of days between these dates (general idea only!!!).
Описание слайда:
Exercise 3.3.3. Create a method that gets two dates and returns number of days between these dates (general idea only!!!).



Похожие презентации
Mypresentation.ru
Загрузить презентацию