[go: up one dir, main page]

Menu

[r767]: / stringtools.pas  Maximize  Restore  History

Download this file

54 lines (37 with data), 1.8 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ $Id: stringtools.pas 6984 2005-08-21 09:43:05Z mkaemmerer $
This is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
The software is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this software; see the file gpl.txt. If not, write to the
Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
Created on November, 16st 2000 by Markus K„mmerer <mk@happyarts.de>
This software is part of the OpenXP project (www.openxp.de).
}
{$I xpdefine.inc}
unit stringtools;
interface
uses
xpglobal, { Nur wegen der Typendefinition }
sysutils;
// converts TDateTime to ZConnect Date and Time String
function DateTimeToZCDateTime(DateTime: TDateTime): String;
// converts ZConnect Date and Time String to TDateTime
function ZCDateTimeToDateTime(const s: String): TDateTime;
implementation
uses typeform;
function DateTimeToZCDateTime(DateTime: TDateTime): String;
begin
Result := FormatDateTime('yyyymmddhhnnss', DateTime);
end;
function ZCDateTimeToDateTime(const s: String): TDateTime;
begin
Result := EncodeDate(StrToIntDef(LeftStr(s,4),0), StrToIntDef(copy(s,5,2),0), StrToIntDef(copy(s,7,2),0))
+ EncodeTime(StrToIntDef(copy(s,9,2),0), StrToIntDef(copy(s,11,2),0), StrToIntDef(copy(s,13,2),0), 0);
end;
end.