08-24-2023
06:09 AM
- last edited on
08-24-2023
10:26 PM
by
JackLacava
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!
08-24-2023 08:58 AM - edited 08-24-2023 10:28 AM
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))