Re: [Lazarus] Date value "0"
Tony Whyman wrote: I must say that I'm amazed at how long this thread is - but then I shouldn't be. Many moons ago, I used to work at the long gone British Mainframe Computer company ICL. Here, there was a well used term "a bicycle sheds argument". This supposedly came from the sales force retelling how the board of a large company had once taken two minutes to approve the purchase of a multi-million pound mainframe and then spent the next two hours discussing a small bill for the repair of the office bicycle shed. This was allegedly because they all understood bicycle sheds, but none of them had a clue how a computer worked. :-) This thread could well be an example of such an argument. Perhaps we should leave it as: The 24 hour clock is a modulo 24 numbering system, starting at midnight. The 12 hour clock is a modulo 12 numbering system starting at midnight and noon, where zero is conventionally written as "12", with conventions distinguishing the periods between noon and midnight and midnight and noon. Yes, I think that's a good informal description. Particularly in view of the fact that efforts were made to measure time in Europe before numeric zero was widely adopted. Now please let's not get bogged down in "unequal hours". -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
I must say that I'm amazed at how long this thread is - but then I shouldn't be. Many moons ago, I used to work at the long gone British Mainframe Computer company ICL. Here, there was a well used term "a bicycle sheds argument". This supposedly came from the sales force retelling how the board of a large company had once taken two minutes to approve the purchase of a multi-million pound mainframe and then spent the next two hours discussing a small bill for the repair of the office bicycle shed. This was allegedly because they all understood bicycle sheds, but none of them had a clue how a computer worked. This thread could well be an example of such an argument. Perhaps we should leave it as: The 24 hour clock is a modulo 24 numbering system, starting at midnight. The 12 hour clock is a modulo 12 numbering system starting at midnight and noon, where zero is conventionally written as "12", with conventions distinguishing the periods between noon and midnight and midnight and noon. As to why this is so, I would quote the late great Douglas Adams "because the stupid monkey didn't know any better". Tony On 28/05/15 17:35, patspiper wrote: On 28/05/15 18:57, Jürgen Hestermann wrote: Am 2015-05-28 um 17:14 schrieb waldo kitty: i don't know why it isn't confident... am is morning so 12am is the very first entry into morning as 12pm is the very first entry into afternoon... i don't understand the confusion or the problem... So the day starts with 12 at midnight and then switches to 1 an hour later? If that isn't confusing... In am/pm mode, this is how it goes indeed. When it is 30 minutes past midnight, you say it is 12:30 (implicit am). An hour later, it becomes 1:30. In military time (24 hrs), then they become 00:30 and 1:30. Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
Gordon Cooper wrote: I once worked in the international section of the New Zealand Meteorological Servce, which used Greenwich Time (UTC). So, each day started at noon, 12 hours behind local time. Plenty of scope for confusion there. But was conveniently in line with the astronomical convention of the day starting at Noon. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On 05/27/2015 05:05 AM, Mark Morgan Lloyd wrote: Gordon Cooper wrote: We were taught that 24.00 did not exist. Time went from 23.59 to 00.00. The same rule can be applied to 11.59 am & pm. Except where there's a leap second. speaking of which, guess what is coming up... [quote] Date: Mon, 05 Jan 2015 14:25:49 +0100 From: IERS EOP Product Center Reply-To: IERS EOP Product Center To: bulc.i...@obspm.fr INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS) SERVICE INTERNATIONAL DE LA ROTATION TERRESTRE ET DES SYSTEMES DE REFERENCE SERVICE DE LA ROTATION TERRESTRE DE L'IERS OBSERVATOIRE DE PARIS 61, Av. de l'Observatoire 75014 PARIS (France) Tel. : 33 (0) 1 40 51 22 26 FAX : 33 (0) 1 40 51 22 91 e-mail: services.i...@obspm.fr http://hpiers.obspm.fr/eop-pc Paris, 5 January 2015 Bulletin C 49 To authorities responsible for the measurement and distribution of time UTC TIME STEP on the 1st of July 2015 A positive leap second will be introduced at the end of June 2015. The sequence of dates of the UTC second markers will be: 2015 June 30, 23h 59m 59s 2015 June 30, 23h 59m 60s 2015 July 1, 0h 0m 0s The difference between UTC and the International Atomic Time TAI is: from 2012 July 1,0h UTC, to 2015 July 1 0h UTC : UTC-TAI = - 35s from 2015 July 1,0h UTC, until further notice: UTC-TAI = - 36s Leap seconds can be introduced in UTC at the end of the months of December or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every six months, either to announce a time step in UTC or to confirm that there will be no time step at the next possible date. Daniel Gambis Head Earth Orientation Center of IERS Observatoire de Paris, France [/quote] ;) O:) -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
I once worked in the international section of the New Zealand Meteorological Servce, which used Greenwich Time (UTC). So, each day started at noon, 12 hours behind local time. Plenty of scope for confusion there. Fortunately this was several decades before computers appeared. Gordon. On 29/05/15 08:16, Marc Santhoff wrote: So the day starts with 12 at midnight and then switches to 1 an hour later? >If that isn't confusing... -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On Do, 2015-05-28 at 17:57 +0200, Jürgen Hestermann wrote: > Am 2015-05-28 um 17:14 schrieb waldo kitty: > > i don't know why it isn't confident... am is morning so 12am is the very > > first entry into morning as 12pm is the very first entry into afternoon... > > i don't understand the confusion or the problem... > > > > So the day starts with 12 at midnight and then switches to 1 an hour later? > If that isn't confusing... Wikipedia tries to de-confuse a bit: https://en.wikipedia.org/wiki/12-hour_clock https://en.wikipedia.org/wiki/12-hour_clock#Confusion_at_noon_and_midnight Other countries may have other conventions ... For the germans: https://de.wikipedia.org/wiki/2-mal-12-Stunden-Z%C3%A4hlung HTH, Marc -- Marc Santhoff -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
Jürgen Hestermann wrote: Am 2015-05-28 um 17:14 schrieb waldo kitty: i don't know why it isn't confident... am is morning so 12am is the very first entry into morning as 12pm is the very first entry into afternoon... i don't understand the confusion or the problem... So the day starts with 12 at midnight and then switches to 1 an hour later? If that isn't confusing... In fairness "12 Noon" is a common English idiom while "zero midnight" isn't. If using the 12-hour clock it's common to say "five to twelve" shortly before either midday or midnight and "five past twelve" afterwards... I've never heard anybody say "five past zero". So I'd expect "12 Midnight" to not give anybody major problems. But I still avoid setting equipment which reports time using a.m./p.m. around midnight or midday- who knows what ghouls lurk in the firmware. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On 28/05/15 18:57, Jürgen Hestermann wrote: Am 2015-05-28 um 17:14 schrieb waldo kitty: i don't know why it isn't confident... am is morning so 12am is the very first entry into morning as 12pm is the very first entry into afternoon... i don't understand the confusion or the problem... So the day starts with 12 at midnight and then switches to 1 an hour later? If that isn't confusing... In am/pm mode, this is how it goes indeed. When it is 30 minutes past midnight, you say it is 12:30 (implicit am). An hour later, it becomes 1:30. In military time (24 hrs), then they become 00:30 and 1:30. Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On 05/28/2015 11:57 AM, Jürgen Hestermann wrote: Am 2015-05-28 um 17:14 schrieb waldo kitty: i don't know why it isn't confident... am is morning so 12am is the very first entry into morning as 12pm is the very first entry into afternoon... i don't understand the confusion or the problem... So the day starts with 12 at midnight and then switches to 1 an hour later? yes... 12am and 00:00am and 00:00 (24 hour mode) are all the same... If that isn't confusing... it isn't... it never has been, really... i've been using that form for over 50 years with no problems... granted, it doesn't work well with mod12 too well but then noon would be 00:00pm so there has to be some adjustment in code for the human aspect of rendering... it isn't that complicated... i was telling the time correctly by the time i was 3 or 4 and i know that my oldest granddaughter was doing so by 3 because i had a hand in her early education... it wasn't until i was older that i learned military 24 hour nomenclature... then later after that was the 100 minute hour they also use(d?)... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
Am 2015-05-28 um 17:14 schrieb waldo kitty: i don't know why it isn't confident... am is morning so 12am is the very first entry into morning as 12pm is the very first entry into afternoon... i don't understand the confusion or the problem... So the day starts with 12 at midnight and then switches to 1 an hour later? If that isn't confusing... -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On 28/05/15 16:14, waldo kitty wrote: > On 05/28/2015 05:18 AM, Michael Schnell wrote: >> On 05/27/2015 08:48 PM, waldo kitty wrote: >>> >>> yes... 12:00am is midnight... 00:00am is the same... so also is >>> 00:00 or 24:00 in 24hour time... Day runs from 00:00:00 to 23:59:59 (or ::60) in 24h format ;) There is no 24:00:00 :) and must not be :) >>> >> AFAIK it's rather set that 24:00 is 00:00 the next day, but 12:00 >> am is "not 100% confident" as Mark says. > > i don't know why it isn't confident... am is morning so 12am is the > very first entry into morning as 12pm is the very first entry into > afternoon... What of 00:00 AM then ? Same as 12:00 AM ? S'pose it depends on who uses it ;) > > i don't understand the confusion or the problem... > The confusion was what to convert Val(TdateTime) == 0 to ...in package view :) el es -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On 05/28/2015 05:18 AM, Michael Schnell wrote: On 05/27/2015 08:48 PM, waldo kitty wrote: yes... 12:00am is midnight... 00:00am is the same... so also is 00:00 or 24:00 in 24hour time... AFAIK it's rather set that 24:00 is 00:00 the next day, but 12:00 am is "not 100% confident" as Mark says. i don't know why it isn't confident... am is morning so 12am is the very first entry into morning as 12pm is the very first entry into afternoon... i don't understand the confusion or the problem... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
Il 28/05/2015 11:18, Michael Schnell ha scritto: On 05/27/2015 08:48 PM, waldo kitty wrote: yes... 12:00am is midnight... 00:00am is the same... so also is 00:00 or 24:00 in 24hour time... AFAIK it's rather set that 24:00 is 00:00 the next day, but 12:00 am is "not 100% confident" as Mark says. I don't believe this discussion will lead anywhere. The am/pm notation was intended only for humans living outside the polar circles, which just looking out of the window, can easily tell apart midnight from noon. And if they must set the hour for a meeting they don't say "at 12 pm" or "at 0 pm" or whatever, but just "at noon". Even the (underdeveloped) countries which still stick to am/pm notation, when must give the train timetable or the airplane schedules, use the 24h notation. Just my 2c Giuliano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On 05/27/2015 08:48 PM, waldo kitty wrote: yes... 12:00am is midnight... 00:00am is the same... so also is 00:00 or 24:00 in 24hour time... AFAIK it's rather set that 24:00 is 00:00 the next day, but 12:00 am is "not 100% confident" as Mark says. -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On 05/27/2015 03:19 AM, Michael Van Canneyt wrote: Does 12:00 am actually exist ? If so, what is that ? Midnight or midday ? Should not that be 00:00 am ? (or is that the same ?) yes... 12:00am is midnight... 00:00am is the same... so also is 00:00 or 24:00 in 24hour time... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value 0
May be using Julian day is better. Or intermediate conversion to it. http://en.wikipedia.org/wiki/Julian_day Regards, Kamen Оригинално писмо От: Michael Schnell Относно: Re: [Lazarus] Date value 0 До: Lazarus mailing list Изпратено на: Сряда, 2015, Май 27 11:17:06 EEST On 05/27/2015 12:59 AM, Sven Barth wrote: > > Why should that be funny? TDateTime(0.0) is defined as "12/30/1899 > 12:00 am". Now add two days and we are at "1/1/1900 12:00 am", so all > is well... > To me (being born 12/31) it's funny that that the base is not a 1/1, especially 1/1/0001. But of course this is completely irrelevant. -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value 0
It works only if you don't use time. Please look at example: var t, dt: TDateTime; i: integer; s1, s2, s3, s4, s5, s6 : String; begin t := StrToDate('30.12.1899'); i := round (t); s1 := DateTimeToStr(t); s2 := IntToStr(i); t := StrToDate('29.12.1899'); i := round (t); s3 := DateTimeToStr(t); s4 := IntToStr(i); dt := StrToDate('29.12.1700') + StrToTime('18:00:55'); s5 := FormatDateTime('dd.mm. hh.nn.ss', dt); s6 := IntToStr(i); Memo1.Lines.Add (s1 + ' ' + s2 + ' ' + s3 + ' ' + s4 + ' ' + s5 + ' ' + s6); provides 30.12.1899 0 29.12.1899 -1 30.12.1700 05.59.05 -1 Date add 1 day, time not correct If you change date to 29.12.1900 it is ok: 30.12.1899 0 29.12.1899 -1 29.12.1900 18.00.55 -1 If you change date to 29.12.1700 and time to '8:00:55' provides: 30.12.1899 0 29.12.1899 -1 30.12.1700 15.59.05 -1 If you change date to 29.12.1900 and time to '8:00:55' provides ok: 30.12.1899 0 29.12.1899 -1 29.12.1900 08.00.55 -1 If you change date to 29.12.19 and time to '8:00:55' provides: 29.12.2019 08.00.55 -1 (not 19 year) If you change date to 29.12.0019 and time to '8:00:55' provides: 30.12.0019 15.59.05 -1 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.. If you change date to 29.12.-1900: EConvertError: not a valid date format. How can I use date before year? Regards, Kamen Оригинално писмо От: Michael Schnell Относно: Re: [Lazarus] Date value 0 До: lazarus@lists.lazarus.freepascal.org Изпратено на: Сряда, 2015, Май 27 11:44:17 EEST For me it works as expcted var t: TDateTime; i: integer; s1, s2, s3, s4 : String; begin t := StrToDate('30-12-1899'); i := round (t); s1 := DateTimeToStr(t); s2 := IntToStr(i); t := StrToDate('29-12-1899'); i := round (t); s3 := DateTimeToStr(t); s4 := IntToStr(i); Memo1.Lines.Add (s1 + ' ' + s2 + ' ' + s3 + ' ' + s4); provides 30-12-99 0 29-12-99 -1 -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
Juha Manninen wrote: Amazing! Nobody actually looked at the Mantis report nor the patch I referred to, but still answered the mail. The question is about LastUsed date of a Lazarus package link, shown in one of the IDE's dialog windows. Value "0" is wrong in this context because nobody created Lazarus packages nor links between them at year 1899. I leave it as "?", I guess there is no convention for such situations. .. but people please pay a little more attention before answering ... Mea culpa. But this sort of thing bites me so often that it's something I'm touchy about. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
Michael Schnell wrote: On 05/27/2015 11:05 AM, Mark Morgan Lloyd wrote: No it can't. You have to be prepared to parse 12:00 a.m. by context but it's usually midnight. Of which day the one that also has 0:pm or of the previous ? Wp "12-hour clock" shows 11:59 p.m. followed by 12:00 a.m., but I'm not 100% confident in this and sometimes you just have to guess :-) Of course there's the interesting case where there's a leap second as well, because anybody foolish enough to insist on the 12 hour clock would see something like 11:59:59 11:59:60 p.m. 12:00:00 a.m. Anybody with the least bit of sense uses ISO-8601 and 24-hour clock, but it's still possible to get into deep water when one gets things like astronomical observations or timezone offsets. Unfortunately there's a lot of legacy data and embedded kit floating around where timestamps are reported as BCD plus flag bits, and in particular there's things like (derivatives of) the 146818 chip which are both buggy and flexible enough that a firmware writer can make every conceivable bad decision leaving a heck of a mess for the poor so-and-do who has to make sense of logged data remotely. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On 05/27/2015 11:05 AM, Mark Morgan Lloyd wrote: No it can't. You have to be prepared to parse 12:00 a.m. by context but it's usually midnight. Of which day the one that also has 0:pm or of the previous ? -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On 2015-05-27 09:17, Michael Schnell wrote: > To me (being born 12/31) it's funny that that the base is not a 1/1, > especially 1/1/0001. But of course this is completely irrelevant. TDateTime's value of 0 being 1899-12-30 is something Borland adopted from Microsoft to be compatible with Microsoft's Excel or Access. And in turn Microsoft Excel tried to be compatible with Lotus 1-2-3. Back in the 90's I searched the internet for the explanation, but can't remember the details any more. A quick google search now revealed this page, though it doesn't go into much detail. "It appears that the reason for Delphi starting at 30 Dec 1899 is to make it as compatible as possible with Excel while at the same time not adopting Excel's incorrectness about dates." [http://www.delphibasics.co.uk/RTL.asp?Name=TDateTime] Do an internet search for "Microsoft date starts at 1899-12-30" and you'll find a lot more information. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
Gordon Cooper wrote: We were taught that 24.00 did not exist. Time went from 23.59 to 00.00. The same rule can be applied to 11.59 am & pm. Except where there's a leap second. > The same rule can be applied to 11.59 am & pm. No it can't. You have to be prepared to parse 12:00 a.m. by context but it's usually midnight. This is a deeply messy area, not helped at all by the odd conventions adopted by some of the early RTC chips which still turn up in embedded equipment. Gordon. On 27/05/15 19:57, Mattias Gaertner wrote: On Wed, 27 May 2015 09:19:42 +0200 (CEST) Michael Van Canneyt wrote: [...] Does 12:00 am actually exist ? If so, what is that ? Midnight or midday ? Should not that be 00:00 am ? (or is that the same ?) You are not alone with such questions: https://en.wikipedia.org/wiki/12-hour_clock#Confusion_at_noon_and_midnight Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On 2015-05-27 08:19, Michael Van Canneyt wrote: > Does 12:00 am actually exist ? If so, what is that ? Midnight or midday ? Hence I stick to 24 hour time. ;-) Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value 0
For me it works as expcted var t: TDateTime; i: integer; s1, s2, s3, s4 : String; begin t := StrToDate('30-12-1899'); i := round (t); s1 := DateTimeToStr(t); s2 := IntToStr(i); t := StrToDate('29-12-1899'); i := round (t); s3 := DateTimeToStr(t); s4 := IntToStr(i); Memo1.Lines.Add (s1 + ' ' + s2 + ' ' + s3 + ' ' + s4); provides 30-12-99 0 29-12-99 -1 -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value 0
Yes but there is an error on converting date before 12/30/1899: it add 1 day. For example 27.09.1389 converts to 28.09.1389. For date after 12/30/1899 there is no problem. I am using following code: var s, S1: string; dt: TDateTime; S1 := ListItem.SubItems[1]; S1 := trim(S1); dt := StrtoDate(s) + StrToTime(S1); s := FormatDateTime('dd.mm. hh.nn.ss', dt); with Form1 do Begin year.Text := copy(s, 7, 4); month.Text := copy(s, 4, 2); day.Text := copy(s, 1, 2); Or something wrong in my code? Regards, Kamen Оригинално писмо От: Michael Van Canneyt Относно: Re: [Lazarus] Date value 0 До: Lazarus mailing list Изпратено на: Сряда, 2015, Май 27 10:55:23 EEST On Wed, 27 May 2015, Kamen Ketev wrote: > > How can I use TDateTime for date before "12/30/1899 12:00 am". I need it for astronomical calculations. Is it possible to be add flag or something else to ignore this border? You can use TDateTime for this, there is no problem with values < 0. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On 05/27/2015 12:59 AM, Sven Barth wrote: Why should that be funny? TDateTime(0.0) is defined as "12/30/1899 12:00 am". Now add two days and we are at "1/1/1900 12:00 am", so all is well... To me (being born 12/31) it's funny that that the base is not a 1/1, especially 1/1/0001. But of course this is completely irrelevant. -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
We were taught that 24.00 did not exist. Time went from 23.59 to 00.00. The same rule can be applied to 11.59 am & pm. Gordon. On 27/05/15 19:57, Mattias Gaertner wrote: On Wed, 27 May 2015 09:19:42 +0200 (CEST) Michael Van Canneyt wrote: [...] Does 12:00 am actually exist ? If so, what is that ? Midnight or midday ? Should not that be 00:00 am ? (or is that the same ?) You are not alone with such questions: https://en.wikipedia.org/wiki/12-hour_clock#Confusion_at_noon_and_midnight Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On Wed, 27 May 2015 09:19:42 +0200 (CEST) Michael Van Canneyt wrote: >[...] > Does 12:00 am actually exist ? If so, what is that ? Midnight or midday ? > Should not that be 00:00 am ? (or is that the same ?) You are not alone with such questions: https://en.wikipedia.org/wiki/12-hour_clock#Confusion_at_noon_and_midnight Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value 0
On Wed, 27 May 2015, Kamen Ketev wrote: How can I use TDateTime for date before "12/30/1899 12:00 am". I need it for astronomical calculations. Is it possible to be add flag or something else to ignore this border? You can use TDateTime for this, there is no problem with values < 0. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value 0
How can I use TDateTime for date before "12/30/1899 12:00 am". I need it for astronomical calculations. Is it possible to be add flag or something else to ignore this border? Regards, Kamen -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
Am 27.05.2015 09:19 schrieb "Michael Van Canneyt" : > > > > On Wed, 27 May 2015, Sven Barth wrote: > >> >> Am 26.05.2015 15:28 schrieb "Michael Schnell" : >> > >> > On 05/26/2015 01:30 PM, Juha Manninen wrote: >> >> >> >> Is there some convention how to show a date value "0"? >> >> By default it shows year 1899. The patch changed it to "?". >> >> >> > >> > Both funny, as DateTimeToStr(2.0) is "1-1-00" ;-) >> >> Why should that be funny? TDateTime(0.0) is defined as "12/30/1899 12:00 am". Now add two days and we are at "1/1/1900 12:00 am", so all is well... > > > Does 12:00 am actually exist ? If so, what is that ? Midnight or midday ? > Should not that be 00:00 am ? (or is that the same ?) Honestly I don't know, as I simply copy-pasted the value mentioned by Mark, since I'm on mobile and thus a bit lazy ;) Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On Wed, 27 May 2015, Sven Barth wrote: Am 26.05.2015 15:28 schrieb "Michael Schnell" : > > On 05/26/2015 01:30 PM, Juha Manninen wrote: >> >> Is there some convention how to show a date value "0"? >> By default it shows year 1899. The patch changed it to "?". >> > > Both funny, as DateTimeToStr(2.0) is "1-1-00" ;-) Why should that be funny? TDateTime(0.0) is defined as "12/30/1899 12:00 am". Now add two days and we are at "1/1/1900 12:00 am", so all is well... Does 12:00 am actually exist ? If so, what is that ? Midnight or midday ? Should not that be 00:00 am ? (or is that the same ?) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
Am 26.05.2015 15:28 schrieb "Michael Schnell" : > > On 05/26/2015 01:30 PM, Juha Manninen wrote: >> >> Is there some convention how to show a date value "0"? >> By default it shows year 1899. The patch changed it to "?". >> > > Both funny, as DateTimeToStr(2.0) is "1-1-00" ;-) Why should that be funny? TDateTime(0.0) is defined as "12/30/1899 12:00 am". Now add two days and we are at "1/1/1900 12:00 am", so all is well... Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
I changed it to "Never" as suggested by wp. It is a good word in this context. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
Amazing! Nobody actually looked at the Mantis report nor the patch I referred to, but still answered the mail. The question is about LastUsed date of a Lazarus package link, shown in one of the IDE's dialog windows. Value "0" is wrong in this context because nobody created Lazarus packages nor links between them at year 1899. I leave it as "?", I guess there is no convention for such situations. ... but people please pay a little more attention before answering ... Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On 05/26/2015 03:30 PM, Mark Morgan Lloyd wrote: If it were something like Anno Domini 0, which quite simply never existed, then it could be displayed as invalid. It's funny, but AFAIK, you are right. By definition, before Year 1 there was Year -1 and not Year 0. Why TDateTime seemingly uses +2 = 1-1- as a reference is still another riddle. -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
Giuliano Colla wrote: Il 26/05/2015 13:30, Juha Manninen ha scritto: Regarding issue http://bugs.freepascal.org/view.php?id=27735 Is there some convention how to show a date value "0"? By default it shows year 1899. The patch changed it to "?". Delphi for value 0 shows 12/30/1899 12:00 am: Which is an entirely valid date, so should be displayed as such; it could entirely plausibly be a default starting point for e.g. astronomical calculations. If it were something like Anno Domini 0, which quite simply never existed, then it could be displayed as invalid. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
On 05/26/2015 01:30 PM, Juha Manninen wrote: Is there some convention how to show a date value "0"? By default it shows year 1899. The patch changed it to "?". Both funny, as DateTimeToStr(2.0) is "1-1-00" ;-) -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Date value "0"
Il 26/05/2015 13:30, Juha Manninen ha scritto: Regarding issue http://bugs.freepascal.org/view.php?id=27735 Is there some convention how to show a date value "0"? By default it shows year 1899. The patch changed it to "?". Delphi for value 0 shows 12/30/1899 12:00 am: http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/System_TDateTime.html Changing the old Delphi compatible default may force a number of users to modify user manuals/user instructions, messages etc. Is it really a wise move? Giuliano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Date value "0"
Regarding issue http://bugs.freepascal.org/view.php?id=27735 Is there some convention how to show a date value "0"? By default it shows year 1899. The patch changed it to "?". Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus