Im currently designing an user interface which requires to display the current date and time and also let the user edit the current time and date later in the settings.
I have been reading a lot about this issue today but i couldnt find a solution that worked for me. I tried to solve the issue with the QProcess by creating an QProcess object and executing the commands on the linux device my user interface is for. I just seem to struggle with the "date" command when i try to set the time.
This is my current code to change the system time of my linux device with the "date" command.
My issue is that if i run my programm with the "args << ...." line commented it shows me the StdOut of the current system time. BUT if i run the code with the args and try to set time i always get the same error message StdError "date: invalid date '"Mon Jan 23 09:30:17 UTC 2023"' for every possible format. i have tried many different formats and variations how you can set the time but i always get the same error message.
QProcess task;
QString command;
QStringList args;
command = "date";
// I tried many different time formats but all of seem to be invalid
args << "--set=\"Mon Jan 23 09:30:17 UTC 2023\"";
task.start(command, args);
task.waitForFinished();
QString StdOut = task.readAllStandardOutput();
QString StdError = task.readAllStandardError();
ui->lineEdit_13->setText(StdOut);
ui->lineEdit_14->setText(StdError);
Does anyone know what might be my problem and how to fix it? I surely cant be that hard to change the time of a device.
Thanks in advance for the answers :)

Could you try:
You have an issue with the quotes.
Also, please note that you need to run your app with enough access privileges to modify the system date.