DelphiBasics
PDateTime
Type
Pointer to a TDateTime value System unit
  type PDateTime = ^TDateTime;
Description
The PDateTime type is a pointer to a TDateTime value.
 
Pointer arithmetic, such as Inc, Dec can be used on it, for example to navigate a block of TDateTime values, as in the example.
Related commands
Dec Decrement an ordinal variable
Inc Increment an ordinal variable
TDateTime Data type holding a date and time value
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.


 
Example code : Store 3 TDateTime values in memory and navigate through them
var
  dateTimePtr : PDateTime;
  a : TDateTime;

begin
  // Allocate storage for three date time variables
  GetMem(dateTimePtr, 3 * SizeOf(Extended));

  // Fill out these date time variables
  dateTimePtr^ := Yesterday;
  Inc(dateTimePtr);
  dateTimePtr^ := Date;
  Inc(dateTimePtr);
  dateTimePtr^ := Tomorrow;

  // Now display these values
  Dec(dateTimePtr, 2);
  ShowMessage('Yesterday = '+DateToStr(dateTimePtr^));
  Inc(dateTimePtr);
  ShowMessage('Today     = '+DateToStr(dateTimePtr^));
  Inc(dateTimePtr);
  ShowMessage('Tomorrow  = '+DateToStr(dateTimePtr^));
end;
Show full unit code
   Typical program output:
  
   Yesterday = 10/04/2003
   Today     = 11/04/2003
   Tomorrow  = 12/04/2003
 
Delphi Programming Neil Moffatt 2002 - 2016. All rights reserved.  |  Home Page