# Plex beginsAT time

**URL:** <https://forums.plex.tv/t/plex-beginsat-time/912168>\
**Category:** General Discussions\
**Created:** [April 7, 2025, 6:25pm UTC](https://forums.plex.tv/t/plex-beginsat-time/912168 "2025-04-07T18:25:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronclifford66](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@ronclifford66](https://forums.plex.tv/u/ronclifford66)\
**Post date:** [April 7, 2025, 6:25pm UTC](https://forums.plex.tv/t/plex-beginsat-time/912168/1 "2025-04-07T18:25:57Z")

</div>

How does on convert the BeginsAt time to localtime. No matter what I try it converts to 21:00 when it should be 22:00 when using powershell.

---

<div class="post-metadata">

**Author:** ![pshanew](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pshanew/32/160555_2.png) [@pshanew](https://forums.plex.tv/u/pshanew)\
**Post date:** [April 7, 2025, 6:44pm UTC](https://forums.plex.tv/t/plex-beginsat-time/912168/2 "2025-04-07T18:44:33Z")

</div>

Adapted from some Stack Overflow proposals (though I’ve done similar in C#):

```auto
# Get DateTime object representing 1/1/1970 at midnight
$epoch = New-Object -Type DateTime 1970, 1, 1, 0, 0, 0, 0

# Add Unix epoch timestamp to the origin time, result is UTC
$timestamp = $epoch.AddSeconds(1744050670)

# Convert timestamp to local time
$timestamp_local = [TimeZone]::CurrentTimeZone.ToLocalTime($timestamp)

# Print result
$timestamp_local

# Just the time as a string, in 24 hour format
$time_string = $timestamp_local.ToString("HH:mm")

```

This assumes that the beginsAt value you’re pulling is indeed a Unix timestamp (as are most in the Plex databases these days).

[Edit]  
Or, most of the above in one step (plus the string conversion):

```auto
$beginsAt = Get-Date -UnixTimeSeconds 1744050670

$beginsAtStr = $beginsAt.ToString("HH:mm")

```

---

<div class="post-metadata">

**Author:** ![ronclifford66](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@ronclifford66](https://forums.plex.tv/u/ronclifford66)\
**Post date:** [April 7, 2025, 9:54pm UTC](https://forums.plex.tv/t/plex-beginsat-time/912168/3 "2025-04-07T21:54:16Z")

</div>

Thanks that works. I spent an hour or more with copilot giving me scripts that always were one hour off.

---

<div class="post-metadata">

**Author:** ![pshanew](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pshanew/32/160555_2.png) [@pshanew](https://forums.plex.tv/u/pshanew)\
**Post date:** [April 8, 2025, 12:02am UTC](https://forums.plex.tv/t/plex-beginsat-time/912168/4 "2025-04-08T00:02:00Z")

</div>

> [@ronclifford66](#):
>
> Thanks that works.

You’re welcome, glad you got it working!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [July 7, 2025, 12:02am UTC](https://forums.plex.tv/t/plex-beginsat-time/912168/5 "2025-07-07T00:02:54Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
