|
From: Rafał Z. <rzi...@sy...> - 2014-08-18 10:46:33
|
Hallo,
I have following code:
result='0'
try:
datetime.datetime.strptime(str(data),'%Y%m%d')
result = '1'
except ValueError:
result = '0'
if I run it with data='20141311' in commandline then an exception is
thrown in result becomes '0'.
In jython I get always 1! If I change the code to:
result='0'
try:
t=datetime.datetime.strptime(str(data),'%Y%m%d')
result =str(t)
except ValueError:
result = '0'
then I get restult=2015-01-01 00:00:00 !
Where is the difference?
with regards
Rafal Ziolkowski
SYNEKTIK S.A.
Al. W. Witosa 31
00-710 Warszawa
fax: +48 22 849 80 55
www.synektik.pl<http://www.synektik.pl/>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sąd Rejonowy dla m.st. Warszawy w Warszawie, XIII Wydział Gospodarczy Krajowego Rejestru Sądowego
NIP 521-31-97-880, kapitał zakładowy 4 264 564,50 PLN.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Informacja o poufności: Wiadomość jest przeznaczona wyłącznie dla zamierzonego adresata i może zawierać informacje o charakterze poufnym
i/lub zastrzeżonym. W razie stwierdzenia, że odbiorcą miała być inna osoba prosimy poinformować nadawcę oraz niezwłocznie usunąć
wiadomość ze swojej skrzynki pocztowej. Wykonywanie kopii, dystrybucja lub używanie do innych celów niniejszego email'a jest zabronione.
Synektik S.A. nie ponosi żadnej odpowiedzialności za zmiany email'a dokonane po jego wysłaniu.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Confidentiality Notice: This message is for the intended recipient only and it may contain confidential and/or privileged information.
If you receive this message in error, please immediately notify the sender and delete the message from your inbox. Unauthorized copying,
distribution or any action taken in reliance thereon are strictly prohibited and may be unlawful. Synektik S.A. takes no responsibility for
changes done to this e-mail after it was sent.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|