Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Get-NAVServerSession change time zone

(0) ShareShare
ReportReport
Posted on by

Hi all,

When i use "Get-NAVServerSession " from powershell i get the UTC time zone, but i need  my time zone, in this case UTC+1.

ServerInstanceID SessionID UserSID ServerInstanceName ServerComputerName UserID ClientType ClientComputerName LoginDatetime DatabaseNa
---------------- --------- ------- ------------------ ------------------ ------ ---------- ------------------ ------------- ----------
1111 2947 id user bbdd server USUARIO WindowsClient EQUIPO 1 15/04/2021 5:54:12 BBDD  -->time zon utc
1111 2949 id user bbdd server USUARIO WindowsClient EQUIPO 2 15/04/2021 5:58:31 BBDD --< time zone utc

thanks in advance.

  • Community Member Profile Picture
    on at
    RE: Get-NAVServerSession change time zone

    Thanks

  • Community Member Profile Picture
    on at
    RE: Get-NAVServerSession change time zone

    Thnaks !!!

  • Suggested answer
    Suresh Kulla Profile Picture
    47,787 on at
    RE: Get-NAVServerSession change time zone

    You could write something like this

    Function Get-LocalTime($UTCTime)

    {

    $strCurrentTimeZone = (Get-WmiObject win32_timezone).StandardName

    $TZ = [System.TimeZoneInfo]::FindSystemTimeZoneById($strCurrentTimeZone)

    $LocalTime = [System.TimeZoneInfo]::ConvertTimeFromUtc($UTCTime, $TZ)

    Return $LocalTime

    }

    $sessions = Get-NAVServerSession -ServerInstance NAV2016

    foreach($session in $sessions)

    {

      Write-Output Get-LocalTime($session.LoginDateTime)

    }

  • Suggested answer
    srttel Profile Picture
    on at
    RE: Get-NAVServerSession change time zone

    The LoginDate is stored as UTC time format on the SQL Server.

    So the cmdlet will return the value in UTC.

    But you can format or recalculate the value once you have retrieved it.

    $myvar = Get-NAVServerSession bc180

    $myvar.LoginDatetime

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
YUN ZHU Profile Picture

YUN ZHU 606 Super User 2025 Season 1

#2
Mansi Soni Profile Picture

Mansi Soni 463

#3
Sagar Dangar, MCP Profile Picture

Sagar Dangar, MCP 391

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans