Skip to content

Converts to Datetime (Unwanted) #27

@midacts

Description

@midacts

ConvertFrom-Yaml is converting strings to datetime.

I understand that '12/31/1999' looks like a date format, but i am passing it in as a string because i want the value to actually be '12/31/1999'

# Test YAML
$y = @"
test:
  tag: 12/31/1999
@"

# Converts to PS object
$PSObj = $y | ConvertToYaml

# Outputs the results
C:\> $PSObj['test']

Name                  Value
----                      -----
tag                      12/31/1999 12:00:00 AM

# Shows the type
C:\> $PSObj['test'].tag.gettype()

IsPublic IsSerial Name
-------- -------- ----
True     True     DateTime

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions