[fpc-pascal] Explicit date from double format

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Wed Sep 29 23:13:12 CEST 2004



On Wed, 29 Sep 2004, Anton Tichawa wrote:

> Michael Van Canneyt wrote:
> 
> >On Wed, 29 Sep 2004, Jilani Khaldi wrote:
> >
> >  
> >
> >>Hi All,
> >>Does somebody kown the algorithm to convert a date from the double
> >>format  to an explicit format?
> >>Example: the function "now" givers me: 3.825956615197917E+004
> >>I want to transform it in: year-month-day....
> >>    
> >>
> >
> >
> >Why not use DateToStr() or FormatDateTime() from sysutils ?
> >
> >Michael.
> >
> >_______________________________________________
> >fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> >http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> >
> >  
> >
> Or, if you need the values for some sort of calculation, you have to
> 
> - find out the reference date, i. e. DateToStr(0)
> - and the scale, (I think 1.0 = 1 day)
> - consider the month lengths, with february changing in leap years
> - for historic dates, consider calendar switches
> 
> There's a conversion function somewhere on my hard disk. If I find it, 
> I'll post it later.

The dateutils unit that comes with FPC 1.9.x contains a bazillion conversion routines.

Michael




More information about the fpc-pascal mailing list