I'm trying to send rows of string to a remote SFTP server.
I'm using SftpClient With Renci.SSHNet.
This is how I build my rows of string:
row = string.Format("{0},{1},{2},{3:dd/MM/yyyy HH:mm:ss},{4:dd/MM/yyyy HH:mm:ss},{5:dd/MM/yyyy HH:mm:ss},{6},{7},{8},{9},{10},{11}", queue_id, queue_name, taskId,
customRow.createdTime.AddSeconds(secondsAdd), first_handled_date_and_time.AddSeconds(secondsAdd), customRow.closedTime.AddSeconds(secondsAdd),
task_work_time_in_s, after_task_work_time_in_s, queuing_time_in_s, is_handled_within_service_level, task_status_description, handling_time);
This is my code to upload the rows:
using (SftpClient sftp = new SftpClient(con))
{
try
{
if (sftp.IsConnected)
sftp.Disconnect();
sftp.OperationTimeout = TimeSpan.FromTicks((TimeSpan.TicksPerMinute * 5));
sftp.Connect();
sftp.WriteAllLines(filePath, content, encoding);
}
.
.
.
}
The field content is an array of row from the previous code part.
My main problem is that the date format in the file that arrives is dd/MM/yyyy for the first column and MM-dd-yyyy in the other 2 date columns.
Can someone please explain it to me or tell me what am I doing wrong?
Thank you in advance