All Products
Search
Document Center

Function Compute:What can I do if the time recorded in Simple Log Service is inconsistent with the time obtained in the program?

Last Updated:Feb 20, 2024

Differences between the time recorded by Simple Log Service and the time of Function Compute may be caused by different time formats and time zones that are used by the two services.

By default, Function Compute run in UTC time. For example, for 12:00 at UTC+8, you must use 04:00 in Function Compute. You can modify the time zone of Function Compute by using environment variables. For example, you can set the value of TZ to Asia/Shanghai to change the time zone of Function Compute to UTC+8. For more information, see Environment variables.

Be noted that in a Node.js runtime, if you print dates by using console.log(date), the UTC time is used. You can convert it into a string before you print the date, for example, console.info(new Date().toLocaleString());.