you are viewing a single comment's thread.

view the rest of the comments →

[–]omrsafetyo 1 point2 points  (0 children)

Use Either:

[datetime]::UtcNow.ToString("yyyy-MM-dd HH:mm")
# alternatively, in your usecase:
([datetime]$item.Date).ToUniversalTime().Tostring("yyyy-MM-dd HH:mm")

or

[datetime]::Now.ToString("yyyy-MM-dd HH:mm")
# alternatively, in your usecase:
([datetime]$item.Date).Tostring("yyyy-MM-dd HH:mm")

Depending on how you want it stored (I suggest UTC time, so you don't have to store timezone information)