FlexCel Studio for VCL/LCL
ContentsIndex
PreviousUpNext
FlxTryStrToDateTime Function

Tries to convert a string to a TDateTime.

Pascal
function FlxTryStrToDateTime(const S: UTF16String; out Value: TDateTime; var dFormat: UTF16String; var HasDate: boolean; var HasTime: boolean; const DateFormat: UTF16String = ''; const TimeFormat: UTF16String = ''): Boolean;
C++
Boolean FlxTryStrToDateTime(const UTF16String S, TDateTime Value, UTF16String dFormat, boolean HasDate, boolean HasTime, const UTF16String DateFormat = '', const UTF16String TimeFormat = '');
Parameters 
Description 
const S: UTF16String 
String with the date. 
out Value: TDateTime 
S converted to a TDateTime. 
var dFormat: UTF16String 
Returns the date format used to convert. 
var HasDate: boolean 
Returns true if the string has a date format. 
var HasTime: boolean 
Returns true if the string had a time format. 
const DateFormat: UTF16String = '' 
Optional parameter. If you specify a string here like "dd/mm/yyyy" this will be returned in dformat if the string contains a date. 
const TimeFormat: UTF16String = '' 
Optional parameter. If you specify a string here like "hh:mm:ss" this will be returned in dformat if the string contains time. 

True if the string could be converted, false otherwise. 

 

This routine uses the locale in the machine where the application is running to try to guess the correct date. 

This means for example that if your locale is "dd/mm/yyyy" the date 5/8/2004 will be converted to Agust 5, 2004, while if you have "mm/dd/yyyy" the date will be May 8, 2004.

Copyright (c) 2002-2008 TMS Software. All rights reserved.
What do you think about this topic? Send feedback!