Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-05

Extended format codes in FormatDateTime

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Werner Pamler

In BugTracker, #0026168, I posted a patch to FormatDateTime which allows to use hour, minute, or second format codes in square brackets. If such codes are found in the format string the values of the corresponding quantitites do no longer overflow, but can grow beyond their usual limit of 24 (for hours) or 60 (for minutes and seconds). The idea behind that is that when adding or subtracting times the hours often become greater than 24, but there may be a wish to keep an hh:nn format without days. I need that feature in my current work with the fpspreadsheet date/time formats since Excel offers this [h]:mm:ss format string. Currently I have a patched version in the package, but it certainly would be better to have this feature in fpc/Lazarus generally.

Reply by email

Marco van de Voort
to Werner Pamler
Werner Pamler wrote
In BugTracker, #0026168, I posted a patch to FormatDateTime which allows to use hour, minute, or second format codes in square brackets.

Using new special characters instead of building on existing escape characters is incompatible.

Reply by email

Michael Van Canneyt
to Marco van de Voort
Marco van de Voort wrote 6 lines
On Fri, May 16, 2014 at 01:19:15AM +0200, Werner Pamler wrote: > In BugTracker, #0026168, I posted a patch to FormatDateTime which allows > to use hour, minute, or second format codes in square brackets. Using new special characters instead of building on existing escape characters is incompatible.

This could be remedied with a FormatDateTimeEx() or else a FormatDateTime(Fmt,date,AllowExtendedFormatting: Boolean = False)

Michael.

Reply by email