20 April 2011

Convert DateTime String to UTCDateTime

If you need to convert a string containing a DateTime use the following function:
dateTime = str2datetime("24.12.2011 12:01:59", 123);

dateTime = str2datetime( "2011/02/25 23:04:59" ,321 );
dateTime = str2datetime( "Feb-2011-25 11:04:59 pm" ,231 );
dateTime = str2datetime( "2 25 2011 11:04:59 pm" ,123 );
The sequence 123 describes the position of day (1), month (2), year (3). The function DateTimeUtil::any2DateTime() is working different. it is working with dates but its not working with strings:
Date date = 01\05\2012;
;

DateTimeUtil::newDateTime(date,str2time('00:00:00'));