I'm trying to automate some of my recurring tasks. Amongst other jobs, i want to automate the LDAP Account Creation. Since we have employes with fixed-term employment contract, i want to automatically set the deactivation Date of these LDAP-Accounts to the last Day working.
Our tool where I do the automation supports DelphiScript, VBScript and JavaScript. Additionaly it would support PowerShell scripts.
I have a Date variable which i could declare as DateTime
or as String
.
As DateTime
it will look like 44366,3996712847
converted as a String
it will look like 19.06.2021 09:36:35
. In the end I need to convert one of these values as a 18 digit timestamp, so i can set a Account Expiration Date in LDAP.
A few years ago I did a lot in C#, but nothing with Delphi, JScript and VBScript. I'm also out of C# by now.
My approaches, where I first tried to Convert String to DateTime, look like this:
uses
Classes, SysUtils;
var
befristet: datetime;
timestamp: string;
begin
befristet := GetVarContent('DATA.Befristet');
timestamp := DateTimeToTimeStamp(befristet);
// Writing to Log
LogMessage('VarContent: ' + befristet);
// Returns 0 as script result
Result := 0;
end;