I have set the global variable for my timezone both in the terminal and in my mysql-config file to UTC+2.
mysql> SET GLOBAL time_zone = '+02:00';
Query OK, 0 rows affected (0,00 sec)
mysql> select current_timestamp;
+---------------------+
| current_timestamp |
+---------------------+
| 2023-10-18 06:33:32 |
+---------------------+
1 row in set (0,00 sec)
In my terminal I get the correct time when selecting CURRENT_TIMESTAMP. But when I do the following on Rust in the same database:
let result = sqlx::query(
"SELECT CAST(CURRENT_TIMESTAMP AS CHAR) AS xxx",
)
.fetch_one(&mysql.conn)
.await;
match result {
Err(e) => {
println!("Error {}", e);
},
Ok(r) => {
let time : String = r.try_get("xxx").unwrap();
println!("Time: {}", time);
}
};