<HTML><BODY>
<p>It works only if you don't use time. Please look at example:<br></p><p>var t, dt: TDateTime;<br> i: integer;<br> s1, s2, s3, s4, s5, s6 : String;<br> begin<br><br> t := StrToDate('30.12.1899');<br> i := round (t);<br> s1 := DateTimeToStr(t);<br> s2 := IntToStr(i);<br> t := StrToDate('29.12.1899');<br> i := round (t);<br> s3 := DateTimeToStr(t);<br> s4 := IntToStr(i);<br> dt := StrToDate('29.12.1700') + StrToTime('18:00:55');<br> s5 := FormatDateTime('dd.mm.yyyy hh.nn.ss', dt);<br> s6 := IntToStr(i);<br> Memo1.Lines.Add (s1 + ' ' + s2 + ' ' + s3 + ' ' + s4 + ' ' + s5 + ' ' + s6);</p><p>
<mschnell@lumino.de>provides<br>30.12.1899 0 29.12.1899 -1 30.12.1700 05.59.05 -1<br>Date add 1 day, time not correct<br></mschnell@lumino.de></p><p>If you change date to 29.12.1900 it is ok:<br>30.12.1899 0 29.12.1899 -1 29.12.1900 18.00.55 -1<br></p><p>If you change date to 29.12.1700 and time to '8:00:55' provides:<br>30.12.1899 0 29.12.1899 -1 30.12.1700 15.59.05 -1<br></p><p>If you change date to 29.12.1900 and time to '8:00:55' provides ok: <br>30.12.1899 0 29.12.1899 -1 29.12.1900 08.00.55 -1</p><p>If you change date to 29.12.19 and time to '8:00:55' provides: <br>29.12.2019 08.00.55 -1 (not 19 year)<br></p><p>If you change date to 29.12.0019 and time to '8:00:55' provides:<br>30.12.0019 15.59.05 -1<br>Year is ok, but date and time not. But how I can add value in TSpinEdit 0019? I am using it because in components TDateEdit, TDateTimePicker date must be between 24.9.1752 and 31.12.9999.<br></p><p>If you change date to 29.12.-1900: EConvertError: not a valid date format. How can I use date before 0000 year?</p><p>Regards,<br>Kamen<br></p><br><br><br><br><br>-------- Оригинално писмо --------<br>От: Michael Schnell <mschnell@lumino.de><br>Относно: Re: [Lazarus] Date value 0<br>До: lazarus@lists.lazarus.freepascal.org<br>Изпратено на: Сряда, 2015, Май 27 11:44:17 EEST<br><br><br>For me it works as expcted<br>
<br>
<br>
var t: TDateTime;<br>
i: integer;<br>
s1, s2, s3, s4 : String;<br>
begin<br>
<br>
t := StrToDate('30-12-1899');<br>
i := round (t);<br>
s1 := DateTimeToStr(t);<br>
s2 := IntToStr(i);<br>
t := StrToDate('29-12-1899');<br>
i := round (t);<br>
s3 := DateTimeToStr(t);<br>
s4 := IntToStr(i);<br>
Memo1.Lines.Add (s1 + ' ' + s2 + ' ' + s3 + ' ' + s4);<br>
<br>
<br>
provides<br>
30-12-99 0 29-12-99 -1<br>
<br>
-Michael<br>
<br>
<br>
--<br>
_______________________________________________<br>
Lazarus mailing list<br>
<a href="../servlet/sendmess?ac=sab&to=Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a><br>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br>
</mschnell@lumino.de></BODY></HTML>