One of the features of ESBPCS for VCL we have received lots of positive feedback about is the flexibility of our Date Edits (and the routines that lie below that).
So with ESBDevLib, we wanted to add similar flexibility to the Time side of things. So for the past week I have been working on our “String to Time” methods and I have been very pleased with the results. Like our other methods in ESBDevLib, we have “stand alone” versions as well as those that are associated with Formatters (Classes and Component).
In ESBPCS for VCL, many features for Dates and Times were controlled by Global variables but in ESBDevLib we rely more heavily on Custom Settings options and what that doesn’t cover we add to Formatters as Properties. This makes things more flexible for use in Threads etc… We also supply “simpler” standalone routines that just use the Regional Settings (which the Custom Settings mentioned above do default to).
So as expected, normally formatted time work well with whatever the Time Separator is set to – as well as support for the TimeAMString and TimePMString – but we have added more:
- ‘:’ and ‘ ‘ (space) can be used as time separators in addition to whatever the Time Separator is set to, and separators can be “mixed”.
- AM / PM strings can be prefixes, suffixes, whatever + we do strip out multiple occurrences with PM being seen as the “dominant” if multiple are found.
- we allow ‘am’, ‘a.m.’, ‘a.m’ regardless of TimeAMString and ‘pm’, ‘p.m.’, ‘p.m’ regardless of TimePMString (This was a feature added to ESBPCS for VCL when for a client we were processing CSV files where the times had am / pm entered manually with these three variations through out – since then it has come in very useful for similar situations).
- we allow digit strings where the first two digits are hour, then next two are minutes and next two are seconds – so ‘5’ is seen as 5:00 and ‘1456’ is seen as 14:56
- we allow the Global Strings (which are language based) for ‘Now’, ‘Midnight’ and ‘Noon’
- – we allow for +<Float> and -<Float>, so +0 is the current system time, -1.5 is an hour and half ago, etc.
- when not detecting digit string, the second portion can contain a fractional portion and thus will be rounded – eg ‘1:45:34.7′ would become 1:45:35’.
Testing is looking good on the above, though quite a few of the above where in ESBPCS for VCL.
Next week we plan to get the String to Date side of things a major overhaul. Which will be followed by Date and Time Edits 🙂