note
	description: "Absolute temporal values composed of a date and a time"
	legal: "See notice at end of class."
	status: "See notice at end of class."
	date: "$Date: 2017-03-29 12:26:46 +0000 (Wed, 29 Mar 2017) $"
	revision: "$Revision: 100065 $"
	access: date, time
	eis: "name=Obtaining a DATE from a DATE_TIME and vice versa", "src=$(ISE_DOC_UUID)/195849fc-1a9c-d734-2d2b-acae78133886#Obtaining_a_DATE_from_a_DATE_TIME_and_vice_versa", "tag=EiffelTime"
	eis: "name=DATE / TIME to STRING Conversion", "src=$(ISE_DOC_UUID)/88972ba4-694b-8558-b0c8-87b1fc40afc4", "tag=EiffelTime"

class interface
	DATE_TIME

create 
	make,
	make_fine,
	make_by_date_time,
	make_by_date,
	make_now,
	make_now_utc,
	make_from_epoch,
	make_from_string,
	make_from_string_with_base,
	make_from_string_default,
	make_from_string_default_with_base

feature -- Initialization

	make (y, mo, d, h, mi, s: INTEGER_32)
			-- Set year, month day to y, mo, d.
			-- Set hour, minute, second to h, mi, s.
		require
			correct_date_time: is_correct_date_time (y, mo, d, h, mi, s.to_double, False)
		ensure
			year_set: year = y
			month_set: month = mo
			day_set: day = d
			hour_set: hour = h
			minute_set: minute = mi
			second_set: second = s

	make_fine (y, mo, d, h, mi: INTEGER_32; s: REAL_64)
			-- Set year, month day to y, mo, d.
			-- Set hour, minute, second to h, m, s.
		require
			correct_date_time: is_correct_date_time (y, mo, d, h, mi, s, False)
		ensure
			year_set: year = y
			month_set: month = mo
			day_set: day = d
			hour_set: hour = h
			minute_set: minute = mi
			second_set: fine_second = s

	make_by_date_time (d: DATE; t: TIME)
			-- Set date to d and time to t
		require
			d_exists: d /= Void
			t_exists: t /= Void
		ensure
			date_set: date = d
			time_set: time = t

	make_by_date (d: DATE)
			-- Set date to d and time to origin of time.
		require
			d_exists: d /= Void
		ensure
			date_set: date = d
			time_set: time.is_equal (time.Origin)

	make_now
			-- Get the date and the time from the system.

	make_now_utc
			-- Get the date and the time from the system.

	make_from_string_default (s: STRING_8)
			-- Initialize from a "standard" string of form
			-- default_format_string.
			-- (For 2-digit year specifications, the current century is used as
			-- base century.)
		require
			s_exists: s /= Void
			date_time_valid: date_time_valid (s, default_format_string)

	make_from_string_default_with_base (s: STRING_8; base: INTEGER_32)
			-- Initialize from a "standard" string of form
			-- default_format_string with base century base.
		require
			s_exists: s /= Void
			base_valid: base > 0 and (base \\ 100 = 0)
			date_time_valid: date_time_valid_with_base (s, default_format_string, base)

	make_from_string (s: STRING_8; code: STRING_8)
			-- Initialize from a "standard" string of form
			-- code.
			-- (For 2-digit year specifications, the current century is used as
			-- base century.)
		require
			s_exists: s /= Void
			c_exists: code /= Void
			date_time_valid: date_time_valid (s, code)

	make_from_string_with_base (s: STRING_8; code: STRING_8; base: INTEGER_32)
			-- Initialize from a "standard" string of form
			-- code with base century base.
		require
			s_exists: s /= Void
			c_exists: code /= Void
			base_valid: base > 0 and (base \\ 100 = 0)
			date_time_valid: date_time_valid_with_base (s, code, base)

	make_from_epoch (s: INTEGER_32)
			-- Create a new date time from the number of
			-- seconds since epoch (1 Jan 1970 at 00:00:00).
	
feature -- Access

	date: DATE
			-- Date of the current object

	time: TIME
			-- Time of the current object

	Origin: DATE_TIME
			-- Origin date with origin time

	date_duration: DATE_DURATION
			-- Definite duration between origin of date and current date

	days: INTEGER_32
			-- Number of days elapsed since Origin

	time_duration: TIME_DURATION
			-- Duration elapsed from midnight of the current date

	seconds: INTEGER_32
			-- Number of seconds elapsed from midnight of the current date
	
feature -- Comparison

	is_less alias "<" (other: like Current): BOOLEAN
			-- Is the current object before other?

	is_equal (other: like Current): BOOLEAN
			-- Is the current object equal to other?
	
feature -- Measurement

	duration: DATE_TIME_DURATION
			-- Definite duration elapsed from Origin
		ensure then
			definite_result: Result.definite
	
feature -- Element Change

	set_date (d: DATE)
			-- Set date to d.
		require
			d_exists: d /= Void
		ensure
			date_set: date = d

	set_time (t: TIME)
			-- Set time to t.
		require
			t_exists: t /= Void
		ensure
			time_set: time = t

	copy (other: like Current)
			-- set date and time with the other attributes.
	
feature -- Basic operations

	plus alias "+" (d: DATE_TIME_DURATION): like Current
			-- Sum the current object with d
		require
			d_not_void: d /= Void
		ensure
			result_exists: Result /= Void

	add (dtd: DATE_TIME_DURATION)
			-- Adds dtd to current duration
		require
			dtd_not_void: dtd /= Void

	relative_duration (other: like Current): DATE_TIME_DURATION
			-- Duration from other to current date
		ensure then
			origin_set: equal (other, Result.origin_date_time)

	definite_duration (other: like Current): DATE_TIME_DURATION
			-- Duration from other to the current date, converted to a
			-- definite duration
		require
			other_exists: other /= Void
		ensure
			definite_result: Result.definite

	day_add (d: INTEGER_32)
			-- Add d days to the current date.
		ensure
			days_set: days = old days + d

	hour_add (h: INTEGER_32)
			-- Add h hours to the current time.

	minute_add (m: INTEGER_32)
			-- Add m minutes to the current time.

	second_add (s: INTEGER_32)
			-- Add s seconds to the current time.

	fine_second_add (s: REAL_64)
			-- Add s seconds to the current object.
			-- if s has decimals, fractional_second from time is modified.
	
feature -- Output

	debug_output: STRING_8
			-- Printable representation of the current object
			-- With "standard" form: default_format_string
			-- Was declared in DATE_TIME as synonym of out.

	out: STRING_8
			-- Printable representation of the current object
			-- With "standard" form: default_format_string
			-- Was declared in DATE_TIME as synonym of debug_output.

	formatted_out (s: STRING_8): STRING_8
			-- Printable representation of the current object
			-- With "standard" form: s
		require
			s_exists: s /= Void
	
note
	copyright: "Copyright (c) 1984-2017, Eiffel Software and others"
	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
	source: "[
		Eiffel Software
		5949 Hollister Ave., Goleta, CA 93117 USA
		Telephone 805-685-1006, Fax 805-685-6869
		Website http://www.eiffel.com
		Customer support http://support.eiffel.com
	]"

end -- class DATE_TIME

Generated by ISE EiffelStudio