In Laravel, convert datetime format from TIMESTAMPTZ to TIMESTAMP based on Carbon
1. The date and time format obtained from the upstream interface is: TIMESTAMPTZ. Example: “updated_at”: “2022-05-30t05:53:53.000000z”.
2. Store the upstream value to the current database, and its date and time format is: Timestamp.
3. The code conversion is realized as follows
Carbon::parse('2022-05-30T05:53:53.000000Z')->setTimezone('Asia/Shanghai');
4. The converted format is as follows: 2022-05-30 13:53:53.