[fpc-pascal] date formating dificulty
Graeme Geldenhuys
mailinglists at geldenhuys.co.uk
Wed Nov 19 21:46:27 CET 2014
On 2014-11-19 20:04, Michael Van Canneyt wrote:
> If you need to store a timestamp, use the ISO 8601 format or RFC 3339 (or is it 3999?).
I can't agree more!!
Snippet from tiOPF code
{ Summary of ISO 8601 http://www.cl.cam.ac.uk/~mgk25/iso-time.html }
cIntlDateTimeStor = 'yyyymmdd"T"hhnnss'; // for storage
cIntlDateTimeDisp = 'yyyy-mm-dd hh:nn:ss'; // for display
CIntlDateDisp = 'yyyy-mm-dd'; // for display
See tiIntlDateDispAsDateTime(), tiIntlDateStorAsDateTime() in tiOPF's
tiUtils.pas unit.
I even store TDateTime data as cIntlDateTimeStor formatted strings in
databases. Never had an issue with date conversions since.
Regards,
- Graeme -
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
More information about the fpc-pascal
mailing list