Title: Get-Date -FromUnixTime should support negative values. · Issue #12976 · PowerShell/PowerShell · GitHub
Open Graph Title: Get-Date -FromUnixTime should support negative values. · Issue #12976 · PowerShell/PowerShell
X Title: Get-Date -FromUnixTime should support negative values. · Issue #12976 · PowerShell/PowerShell
Description: Summary of the new feature/enhancement PR #12179 added FromUnixTime parameter to the Get-Date command. In PowerShell 7.1.0-preview.3, the following command causes an error. PS /> Get-Date -Date -1 -FromUnixTime Get-Date: Cannot bind para...
Open Graph Description: Summary of the new feature/enhancement PR #12179 added FromUnixTime parameter to the Get-Date command. In PowerShell 7.1.0-preview.3, the following command causes an error. PS /> Get-Date -Date -1 ...
X Description: Summary of the new feature/enhancement PR #12179 added FromUnixTime parameter to the Get-Date command. In PowerShell 7.1.0-preview.3, the following command causes an error. PS /> Get-Date -Date ...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/12976
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Get-Date -FromUnixTime should support negative values.","articleBody":"## Summary of the new feature/enhancement\r\n\r\nPR #12179 added FromUnixTime parameter to the Get-Date command.\r\nIn PowerShell 7.1.0-preview.3, the following command causes an error.\r\n\r\n```\r\nPS /> Get-Date -Date -1 -FromUnixTime\r\nGet-Date: Cannot bind parameter 'Date'. Cannot convert value \"-1\" to type \"System. DateTime\". Error: \"String '-1' was not recognized as a valid DateTime.\"\r\n```\r\n\r\nThis command should support negative unix time.\r\n\r\nOn Ubuntu, the following commands will not return an error.\r\n\r\n```\r\n$ date --date \"@-1\"\r\nWed Dec 31 23:59:59 UTC 1969\r\n```\r\n\r\n## Proposed technical implementation details (optional)\r\n\r\nThe Date parameter of the Get-Date command has type [DateTime](https://docs.microsoft.com/en-us/dotnet/api/system.datetime). If an integer value is passed for this parameter, it will be interpreted as [Ticks](https://docs.microsoft.com/en-us/dotnet/api/system.datetime.ticks). This must be a positive value.\r\n\r\nIn other words, the following code is invalid.\r\n```\r\nPS /> [datetime] -1\r\nInvalidArgument: Cannot convert value \"-1\" to type \"System.DateTime\". Error: \"Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. (Parameter 'ticks')\"\r\n```\r\n\r\nUnix time can take a negative value, meaning that it is before Unix Epoch.\r\n\r\nTo allow the Date parameter to take a negative integer value, the type of this parameter must be changed to long.\r\nBut this is a breaking change.\r\n\r\nI think the FromUnixTime parameter should be able to take a value, as was suggested in [#11719](https://github.com/PowerShell/PowerShell/issues/11719#issuecomment-581075598).","author":{"url":"https://github.com/aetos382","@type":"Person","name":"aetos382"},"datePublished":"2020-06-17T05:16:35Z","url":"https://github.com/PowerShell/PowerShell/issues/12976"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:dc454e3b-4e0a-f944-bb4b-4d17cea2785e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E52A:126CB9:2975D47:39DA019:6AFD5AAB |
| html-safe-nonce | de4b57eecd268aa20d21425bcec959b0eae89780be44fcc224fb3733f46f98ce |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTJBOjEyNkNCOToyOTc1RDQ3OjM5REEwMTk6NkFGRDVBQUIiLCJ2aXNpdG9yX2lkIjoiMzEyNDY5MjYzOTI1MzYxNzMyMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 03a185854ec51c544c5c76bce7cbec11f30274d203a70d67a58ba883eec8a82e |
| hovercard-subject-tag | issue:640148071 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/12976/issue_layout |
| twitter:image | https://opengraph.githubassets.com/254580a04b53763d0505f43df85873099be080509aefe50d88691e56bced5589/PowerShell/PowerShell/issues/12976 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/254580a04b53763d0505f43df85873099be080509aefe50d88691e56bced5589/PowerShell/PowerShell/issues/12976 |
| og:image:alt | Summary of the new feature/enhancement PR #12179 added FromUnixTime parameter to the Get-Date command. In PowerShell 7.1.0-preview.3, the following command causes an error. PS /> Get-Date -Date -1 ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | aetos382 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b6f01f7cb9f35f8c09949773241a3d49dd04b340 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width