We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
Task: Read the UTC DateTime in an Excel file (attached), convert the value for the PST (Pacific Standard Time) time zone and log each date in the following format: <month name> <day of month>, <full weekday name>. For example: September 8, Tuesday.
This is a solution created for [TechCorner Challenge #11]
[Jscript]
function DateFormat()
{
// Creates a driver
DDT.ExcelDriver("C:\\Challenge11\\DateTime.xls", "Sheet1");
// Iterates through records
while (! DDT.CurrentDriver.EOF())
{
//Display the date in the format <month name> <day of month>, <full weekday name>
DisplayDate();
DDT.CurrentDriver.Next();
}
// Closes the driver
DDT.CloseDriver(DDT.CurrentDriver.Name);
}
function DisplayDate()
{
for(i = 0; i < DDT.CurrentDriver.ColumnCount; i++)
var dateA =aqConvert.VarToStr(DDT.CurrentDriver.Value(i));
//Convert the date from UTC to PST
var dateB = aqDateTime.AddHours(dateA, -8);
var date = aqConvert.DateTimeToFormatStr(dateB,"%B %d, %A");
Log.Message( "The date of " + dateA + " is : " + date );
}
Task: Read the UTC DateTime in an Excel file (attached), convert the value for the PST (Pacific Standard Time) time zone and log each date in the following format: <month name> <day of month>, <full weekday name>. For example: September 8, Tuesday.
This is a solution created for [TechCorner Challenge #11]
Hi sonya_m and SiwarSayahi,
I try again.
# DelphiScript
procedure Challenge_11();
var
fileExcel, exSheet, Valx: OleVariant;
i: Integer;
begin
fileExcel := Excel.Open('C:\\Temp\DateTime.xlsx');
exSheet := fileExcel.SheetByTitle['Sheet1'];
for i := 1 to exSheet.RowCount do
begin
Valx := aqDateTime.AddHours(exSheet.Cell('A', i).Value, -8);
Log.Message(aqConvert.DateTimeToFormatStr(Valx, '%B %d, %A'));
end;
end;
Hi,
thanks sonya_m and SiwarSayahi .
I'll hopefully find this week a quite moment where I can fix it. therefore the answer is yes, I am going to improve my script.
I wish you a nice working day,
E.
Task: Read the UTC DateTime in an Excel file (attached), convert the value for the PST (Pacific Standard Time) time zone and log each date in the following format: <month name> <day of month>, <full weekday name>. For example: September 8, Tuesday.
This is a solution created for [TechCorner Challenge #11]
Hi sonya_m and SiwarSayahi,
I try again.
# DelphiScript
procedure Challenge_11();
var
fileExcel, exSheet, Valx: OleVariant;
i: Integer;
begin
fileExcel := Excel.Open('C:\\Temp\DateTime.xlsx');
exSheet := fileExcel.SheetByTitle['Sheet1'];
for i := 1 to exSheet.RowCount do
begin
Valx := aqDateTime.AddHours(exSheet.Cell('A', i).Value, -8);
Log.Message(aqConvert.DateTimeToFormatStr(Valx, '%B %d, %A'));
end;
end;