Display Date/time and timezone in the Report footer

Vigneshwar
New Contributor

If (uiItem.uiItemType = XFReportUIItemType.PageFooterDate) Then
Dim combinedText As String

' Get the current date and time
Dim currentDateTime
currentDateTime = Now
combinedText = "Date & Time: " & FormatDateTime(currentDateTime, vbLongDate) & " " & FormatDateTime(currentDateTime, vbShortTime)

' Get the local time zone
Dim timeZone
timeZone = "Time Zone: " & TimeZoneInfo.Local.Id

' Combine date/time and time zone
combinedText = combinedText & " | " & timeZone

' Set the text in the report footer
uiItem.Text = combinedText

' Calculate the left position for the combined text to be right-aligned
uiItem.Left = args.Report.CurrentPageInfo.RightPosition - uiItem.Width
End If 

This is my code to display date/time and time zone in the report footer but the code is not pulling the time zone. My question is, is it possible to pull the time zone?? If yes please provide a sample code 

Thanks in advance!

1 REPLY 1

RobbSalzmann
Valued Contributor

The following will give you the three letter Time Zone designation:

Dim regex As New Regex("\b\w")
Dim tz As String = String.Concat(regex.Matches(TimeZoneInfo.Local.StandardName).Cast(Of Match)().Select(Function(m) m.Value))

 

Please sign in! Vigneshwar