Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've noticed a strange issue in the latest versions of the Powershell ONTAP toolkit. When I return the AccessTimeDT of a snapshot using Get-NaSnapshot, the Kind property of the DateTime property is set to local. I can confirm in older versions (1.7 to be precise), it would return the default value of unspecified (which assumes UTC).
What this is doing is causing the .ToLocalTime() method to NOT work on AccessTimeDT. For instance, I'm located in UTC -4 (EST) time zone. Basically, I can only return UTC times.
For example: When I get the AccessTimeDT property of snapshots, they are shown in the UTC time zone. A snapshot shows an AccessTimeDT of 11/1/2012 4:00 PM. In my time, it's actually 11/1/2012 12:00 PM. In past versions, if I call:
$snapshot.AccessTimeDT
# Displays 11/1/2012 4:00 PM
$snapshot.AccessTimeDT.ToLocalTime()
# Displays 11/1/2012 12:00 PM
$snapshot.AccessTimeDT.Kind
# Displays "unspecified"
SInce Upgrading to version 2.2, I get the following results:
$snapshot.AccessTimeDT
# Displays 11/1/2012 4:00 PM
$snapshot.AccessTimeDT.ToLocalTime()
# Displays 11/1/2012 4:00 PM
$snapshot.AccessTimeDT.Kind
# Displays "local"
There is something different going on in the handling of the DateTime objects for snapshots. Are you specifically setting the Kind property to "local" for some reason?
I've verified t his works in 1.7, but not in versions 2.1 and on. I don't have version 2.0 to test with.
Thanks!
Solved! See The Solution
1 ACCEPTED SOLUTION
migration has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for bringing this to our attention. We'll look into what caused this change. In the meantime, you can construct a new DateTime object with an unspecified kind using New-Object DateTime @($snapshot.AccessTimeDT.Ticks).
Thanks,
Steven
8 REPLIES 8
migration has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for bringing this to our attention. We'll look into what caused this change. In the meantime, you can construct a new DateTime object with an unspecified kind using New-Object DateTime @($snapshot.AccessTimeDT.Ticks).
Thanks,
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the suggestion! I look foward to a resolution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please tell me, how to handle snapshots created in daylight saving time!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I see two options:
1) Go to version 1.7 or before.
2) Use this instead:
([DateTime]($snapshot.AccessTimeDT.Ticks)).ToLocalTime()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, that works localy, how does it work for remotely managed NetApps of other timezones?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you'd need to omit the ToLocalTime() method call so it returns UTC if you are querying controllers outside your timezone.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, but for example, Pacific Standard Time (PST) becomes Pacific Daylight Time (PDT)!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are working with UTC I'm not sure how that matters. I may be missing the scenario you are describing...
