GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Set-Date did not work · Issue #5163 · PowerShell/PowerShell

Set-Date did not work #5163

New issue
Copy link
New issue
Copy link
Closed
#6006
Closed
Set-Date did not work#5163
#6006
Copy link
Labels
OS-WindowsResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues
Milestone
6.1.0-Consider

Description

@chucklu
Chuck LU (chucklu)
opened on Oct 19, 2017
Issue body actions

Steps to reproduce

Set-Date -Date (Get-Date).AddDays(3)

I find this command on official document

Expected behavior

should change the datetime on my computer

Actual behavior

Set-Date : The parameter is incorrect
At line:1 char:1
+ Set-Date -Date (Get-Date).AddDays(3)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-Date], Win32Exception
    + FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.SetDateCommand

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.0.0-beta
PSEdition                      Core
GitCommitId                    v6.0.0-beta.6
OS                             Microsoft Windows 10.0.10586
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

I also checked the issue list, and find another issue about set-date test. I am not sure if they are the same issue.

Reacted by Mike Ebersol

Activity

  1. Steve Lee (SteveL-MSFT)
    added
    Area-Cmdlets-Utility
    on Oct 19, 2017
  2. Steve Lee (SteveL-MSFT)
    added this to the 6.1.0-Consider milestone on Jan 24, 2018
  3. Steve Lee (SteveL-MSFT)
    added
    OS-Windows
    on Jan 24, 2018
  4. SteveL-MSFT commented on Jan 24, 2018

    @SteveL-MSFT
    Steve Lee (SteveL-MSFT)
    on Jan 24, 2018
    Member
    More actions

    This works on Ubuntu, but fails on Windows 10 for me

  5. stknohg commented on Jan 24, 2018

    @stknohg
    Takuya Shibata (stknohg)
    on Jan 24, 2018
    Contributor
    More actions

    I reproduced this problem on Windows 10.

    Microsoft.PowerShell.Commands.SetDateCommand.SystemTime should be struct.

    PowerShell/src/Microsoft.PowerShell.Commands.Utility/commands/utility/SetDateCommand.cs

    Lines 117 to 134 in 2f81861

    internal static class NativeMethods
    {
    [StructLayout(LayoutKind.Sequential)]
    public class SystemTime
    {
    public UInt16 Year;
    public UInt16 Month;
    public UInt16 DayOfWeek;
    public UInt16 Day;
    public UInt16 Hour;
    public UInt16 Minute;
    public UInt16 Second;
    public UInt16 Milliseconds;
    }
    [DllImport(PinvokeDllNames.SetLocalTimeDllName, SetLastError = true)]
    public static extern bool SetLocalTime(ref SystemTime systime);
    } // NativeMethods

    Reacted by Steve Lee
  6. MaximoTrinidad commented on Jan 24, 2018

    @MaximoTrinidad
    Maximo Trinidad (MaximoTrinidad)
    on Jan 24, 2018
    More actions

    Confirmed!
    Works in Ubuntu but not Windows 10.

    ubuntusetdate_01_2018-01-24_9-18-40
    windowssetdate_01_2018-01-24_9-14-17

  7. chucklu commented on Jan 25, 2018

    @chucklu
    Chuck LU (chucklu)
    on Jan 25, 2018
    ContributorAuthor
    More actions

    Maximo Trinidad (@MaximoTrinidad) I have checked the release list, the latest version is released five days ago with sha-1 2f81861.
    I will wait for next release version, thanks.

  8. Ilya (iSazonov)
    closed this as completedin #6006on Jan 25, 2018
  9. Ilya (iSazonov)
    added
    Resolution-FixedThe issue is fixed.The issue is fixed.
    on Jan 25, 2018
  10. Ryan Yates (kilasuit)
    added
    WG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues
    and removed
    WG-Cmdlets-Utility
    on Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-WindowsResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues

    Type

    No type

    Projects

    No projects

      Milestone

      • 6.1.0-Consider

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.