Есть ли способ в Delphi 5 преобразовать строку в TDateTime, где вы можете указать фактический формат для использования?
Я работаю над jobprocessor, который принимает задачи с разных рабочих станций. Задачи имеют ряд параметров, некоторые из которых являются датами, но (к сожалению, и вне моего контроля) они передаются как строки. Поскольку рабочие места могут выполняться с разных рабочих станций, фактический формат даты и времени, используемый для форматирования дат в виде строки, может (и, конечно, фактический) различаться.
Поиск в Google, единственные быстрые решения, которые я нашел, заключались в том, чтобы с легкостью изменить переменную ShortDateFormat
и впоследствии восстановить ее исходное значение. Поскольку ShortDateFormat
- глобальная переменная, и я работаю в потоковой среде, единственным способом это будет работать, синхронизируя каждый доступ к ней, что совершенно неприемлемо (и отменено).
Я мог бы скопировать библиотечный код из модуля SysUtils
в свои собственные методы и настроить их для работы с указанным форматом вместо глобальных переменных, но мне просто интересно, есть ли там что-то более адекватное, чтобы я пропущенный.
С уважением, и спасибо заранее,
Виллем
UPDATE
Чтобы сделать это более кратко:
Мне нужно что-то вроде StrToDate
(или StrToDateTime
) с добавленной опцией указания точного формата, который он должен использовать для преобразования строки в TDateTime.