Look into psobjects - Example guide
For example:
[array]$myObject = [pscustomobject]@{
DATE = today's date.
Start = $start_datetime
end = $end_datetime
Source = $source_path
Destination=$destination
}
$myObject | Export-Csv C:\temp\myfile.csv
Edit - I'm not sure how you'll be using Export-Csv. So I will give a couple of examples. However, this really goes beyond the scope of just exporting CSVs as asked. I would recommend rewriting it with more detail about the requirements, or breaking it into several questions.
foreach($thing in $things){
# increment array with multiple rows
[array]$myObject += [pscustomobject]@{
DATE = today's date.
Start = $start_datetime
end = $end_datetime
Source = $source_path
Destination=$destination
}
}
# add data to an existing csv, which has the heading DATEM Start, end, Source, Destination
$myObject | Export-Csv C:\temp\myfile.csv -Append
# if/else logic
if($end_time -gt $somevariable){
[array]$myObject = [pscustomobject]@{
DATE = today's date.
Start = $start_datetime
end = $end_datetime
Source = $source_path
Destination=$destination
}
}else{
[array]$myObject = [pscustomobject]@{
DATE = someotherdate
Start = $start_datetime
end = $end_datetime
Source = $source_path
Destination=$destination
}
}