Skip to main content

Avoid date time in string template

Avoid using `DateTime` objects within string templates, as this can result in the use of session-specific date and time values rather than the universally consistent UTC time. This discrepancy may lead to errors, particularly in scenarios such as database queries, where accurate and standardized date-time formatting is critical. Solution: Instead of embedding `DateTime` directly into string templates, manually format the date-time as a string using the correct UTC format. This ensures consistency across different environments and avoids potential errors related to time zone differences or session-specific date-time configurations.