[fpc-pascal]Question about DATE handling...

Rainer Hantsch rainer at hantsch.co.at
Thu Mar 22 15:01:03 CET 2001


Hello, everybody!

For a CGI program (Linux), I need some date conversions/calculations, but I
have some difficulties.

All of the remaining project is compiled in TurboPascal Mode (no options
like ObjFPC or Delphi specified in FPC 1.0.4). 


Here my problems:
-----------------
If I convert a date string (dd.mm.yyyy) into a numeric value, StrToDate() has
difficulties and causes an EConvertError, if the data are not right. Michawl
suggested to add an "except ... end;" part to this conversion, but then my
compiler sais that it needs either ObjFPC or Delphi mode. (But this compiles
the while stuff of the remaining project differently!) So i cannot use this.
--> Any idea on how to overcome this?

Next, the result of StrToDate() is tDateTime. I can basically live with this,
but: How can I add a specific number of days to this date? (I must calculate a
end date from start-date plus num of days!)
Normally, I use EpochTime as internal date format for all of that, so I 
can simply add/subtract seconds -- and this is perfect. 
--> But how can I get an epoch time out from tDateTime?


Please, leave me an urgent note on that, I stuck.

  Ing. Rainer Hantsch


      \\|//           Ing. Rainer HANTSCH  -  Hardware + Software
      (o o)           Your Partner - Your Supplier - Your Friend!
--oOOo-(_)-oOOo--------------------------------------------------
Ing. Rainer HANTSCH  |  e-Mail: office at hantsch.co.at
Khunngasse 21/20     |  www   : http://www.hantsch.co.at
A-1030 Vienna        |  Tel.  : ++43 - 1 - 7988538 0 
---------------------|  Fax   : ++43 - 1 - 7988538 18
** AUSTRIA **        |  Mobile: ++43 - 663 - 9194382
-----------------------------------------------------------------





More information about the fpc-pascal mailing list