Forum Discussion
date format getting changed from yyyy-mm-dd hh:mm:ss:fff to dd-mm-yyyy hh:mm
Check your value for LongTimePattern.
It looks like you've specified the "HH" component twice.
Cheers,
Lain
Hi Lain,
Thanks for response i am using same format as needed but "HH" component extra getting added.
$OriginalCulture = $host.CurrentCulture.DateTimeFormat.Clone();
$host.CurrentCulture.DateTimeFormat.LongDatePattern = "yyyy-MM-dd";
$host.CurrentCulture.DateTimeFormat.LongTimePattern = "HH:mm:ss.fff";
- LainRobertsonJul 10, 2024Silver Contributor
That's unexpected and not in line with my screenshot from above, which does not feature the extra "HH".
What happens if you run the following line after the original three you've repeated above?
$host.CurrentCulture.DateTimeFormat | Format-List -Property *pattern;
You should see an enumeration of the various formats as shown below, with the change in format reflected in the FullDateTimePattern property:
Cheers,
Lain
- kamleshyadav95Jul 10, 2024Copper ContributorHi Lain,
Yes, Agree I can see that but not sure why this is not coming correctly.
Kamlesh