예제 #1
0
import times

A = times.Time(6, 15, 30, 5)
B = times.Time(8, 9, 15, -4)
C = times.Time(14, 20, 45)
D = times.Time(23, 59)
E = times.Time(12)
F = times.Time()

S = str(A)
S = repr(A)

F.from_utc("06:15:30+05")
F.from_seconds(2300)

R = A == B
R = A != B
R = A < B
R = A <= B
R = A > B
R = A >= B

G = A + 300

N = A - B
예제 #2
0
import times

print("Test Program for the Times Class\n")
# Output Test
print("Output Test".center(30, "-"))
A = times.Time( 6, 15, 30, 5 )
B = times.Time( 8, 9, 15, -4 )
C = times.Time( 14, 20, 45 )
D = times.Time( 23, 59 )
E = times.Time( 12 )
F = times.Time()
print( "str  A: ", str(A) )
print( "repr A: ", repr(A) )
print( "str  B: ", str(B) )
print( "repr B: ", repr(B) )
print( "str  C: ", str(C) )
print( "repr C: ", repr(C) )
print( "str  D: ", str(D) )
print( "repr D: ", repr(D) )
print( "str  E: ", str(E) )
print( "repr E: ", repr(E) )
print( "str  F: ", str(F) )
print( "repr F: ", repr(F) )

# From String Test
print("\n", "From String Test".center(30, "-"), sep="")
T = times.Time()
T.from_str( "06:15:30+05" )
print("Input String: \"06:15:30+05\"\nOutput Time:  ", T)

# Get As Local Test
예제 #3
0
import times

A = times.Time(6, 15, 30, 5)
B = times.Time(8, 9, 15, -4)
C = times.Time(14, 20, 45)
D = times.Time(23, 59)
E = times.Time(12)
F = times.Time()

print("str  A: ", str(A))
print("repr A: ", repr(A))
print("str  B: ", str(B))
print("repr B: ", repr(B))
print("str  C: ", str(C))
print("repr C: ", repr(C))
print("str  D: ", str(D))
print("repr D: ", repr(D))
print("str  E: ", str(E))
print("repr E: ", repr(E))
print("str  F: ", str(F))
print("repr F: ", repr(F))

T = times.Time()
T.from_str("06:15:30+05")
print(T)

local_A = A.get_as_local()  # 06:15:30 AM
local_B = B.get_as_local()  # 08:09:15 AM
local_C = C.get_as_local()  # 02:20:45 PM
local_D = D.get_as_local()  # 11:59:00 PM
local_E = E.get_as_local()  # Noon
예제 #4
0
파일: test.py 프로젝트: kisyular/ClassTime
def main():
    A = times.Time(7, 35, 15, -6)
    B = times.Time(7, 21, 30, -5)
    display(A, B)