Skip to content

Commit 83a1cf8

Browse files
{WebApp} fix the not recognized as a valid DateTime error (#17260)
* {WebApp} fix the not recognized as a valid DateTime error This conversion to localtime should fix the conversion issue due to localization format * Fix for the DateTime.Parse(s.Time) to address the localization issue Fix for the DateTime.Parse(s.Time) to address the localization issue and avoid the error String was not recognized as a valid DateTime * Update ChangeLog.md * Update ChangeLog.md Co-authored-by: Beisi Zhou <[email protected]>
1 parent 041a918 commit 83a1cf8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/Websites/Websites/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Fixed DateTime conversion issue caused by culture
2122

2223
## Version 2.10.0
2324
* Updated `New-AzAppServicePlan` to create an app service plan with host environment id #16094

src/Websites/Websites/Cmdlets/BackupRestore/GetAzureWebAppSnapshot.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using System;
1616
using System.Linq;
1717
using System.Management.Automation;
18+
using System.Globalization;
1819

1920
namespace Microsoft.Azure.Commands.WebApps.Cmdlets.BackupRestore
2021
{
@@ -34,7 +35,7 @@ public override void ExecuteCmdlet()
3435
ResourceGroupName = this.ResourceGroupName,
3536
Name = this.Name,
3637
Slot = string.IsNullOrEmpty(this.Slot) ? "Production" : this.Slot,
37-
SnapshotTime = DateTime.Parse(s.Time)
38+
SnapshotTime = DateTime.Parse(s.Time, CultureInfo.InvariantCulture)
3839
};
3940
}).OrderByDescending(s => s.SnapshotTime).ToArray();
4041
WriteObject(list, true);

0 commit comments

Comments
 (0)