Articles in this section
Category / Section

UTCNow Timestamp Format and Conversion Expression

Published:
Updated:

In Bold Reports, there is an option to include a UTC (Coordinated Universal Time) timestamp. UTC is a global standard time reference used across different time zones, ensuring consistency in time representation. By incorporating a UTC timestamp, synchronize and compare time data accurately, making it particularly useful for applications that involve multiple geographical locations. A particular timezone(IST) is converted to UTC timezone also.

Use the following expressions and formatting options to add a UTC timestamp to your report.

  1. Getting the UTC time:
    To get the current UTC time, use the following expression:

    image.png

    image.png

    =Now.ToUniversalTime()
    
  2. Formatting the UTC time:
    To format the UTC time in a specific way, use the Format function. The following example demonstrates formatting the UTC time as “yyyy-MM-dd HH:mm:ss UTC”:

    image.png

    image.png

    =Format(Now.ToUniversalTime(), "yyyy-MM-dd HH:mm:ss UTC")
    
  3. Convert IST timezone to UTC timezone:
    To convert the IST timezone to UTC timezone, add the following code in code modules and convert it. Follow these steps:

    • Add the following code in code modules in your report.
      image.png

    image.png

    Function ConvertToUtc(dateTime As DateTime) As DateTime
        Return TimeZoneInfo.ConvertTimeBySystemTimeZoneId(dateTime, "India Standard Time", "UTC")
    End Function
    
    • Drag and drop a text box and add the following expression. Click “OK,” save, and preview the report. The current IST time will be converted to UTC time.
      image.png
    =Code.ConvertToUtc(Now())
    

    image.png

By incorporating these expressions into your report, you will be able to include the UTC timestamp as per your requirements.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied