Skip to content

update timespan.xml with new PWSH sample #3741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Define two dates.
$date2 = Get-Date -Date '2010/8/18'-Hour 13 -Minute 30 -Second 30
$date1 = Get-Date -Date '2010/1/1' -Hour 8 -Minute 0 -second 15

# Calculate the interval between the two dates.
$interval = $date2 - $date1
"{0} - {1} = {2}" -f $date2, $date1, ($interval.ToString())

# Display individual properties of the resulting TimeSpan object.
" {0,-35} {1,20}" -f "Value of Days Component:", $interval.Days
" {0,-35} {1,20}" -f "Total Number of Days:", $interval.TotalDays
" {0,-35} {1,20}" -f "Value of Hours Component:", $interval.Hours
" {0,-35} {1,20}" -f "Total Number of Hours:", $interval.TotalHours
" {0,-35} {1,20}" -f "Value of Minutes Component:", $interval.Minutes
" {0,-35} {1,20}" -f "Total Number of Minutes:", $interval.TotalMinutes
" {0,-35} {1,20:N0}" -f "Value of Seconds Component:", $interval.Seconds
" {0,-35} {1,20:N0}" -f "Total Number of Seconds:", $interval.TotalSeconds
" {0,-35} {1,20:N0}" -f "Value of Milliseconds Component:", $interval.Milliseconds
" {0,-35} {1,20:N0}" -f "Total Number of Milliseconds:", $interval.TotalMilliseconds
" {0,-35} {1,20:N0}" -f "Ticks:", $interval.Ticks

<# This sample produces the following output:

18/08/2010 13:30:30 - 01/01/2010 08:00:15 = 229.05:30:15
Value of Days Component: 229
Total Number of Days: 229.229340277778
Value of Hours Component: 5
Total Number of Hours: 5501.50416666667
Value of Minutes Component: 30
Total Number of Minutes: 330090.25
Value of Seconds Component: 15
Total Number of Seconds: 19,805,415
Value of Milliseconds Component: 0
Total Number of Milliseconds: 19,805,415,000
Ticks: 198,054,150,000,000
#>
9 changes: 7 additions & 2 deletions xml/System/TimeSpan.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<TypeSignature Language="C#" Value="public struct TimeSpan : IComparable, IComparable&lt;TimeSpan&gt;, IEquatable&lt;TimeSpan&gt;, IFormattable" />
<TypeSignature Language="ILAsm" Value=".class public sequential ansi serializable sealed beforefieldinit TimeSpan extends System.ValueType implements class System.IComparable, class System.IComparable`1&lt;valuetype System.TimeSpan&gt;, class System.IEquatable`1&lt;valuetype System.TimeSpan&gt;, class System.IFormattable" />
<TypeSignature Language="DocId" Value="T:System.TimeSpan" />
<AssemblyInfo>
<AssemblyInfo>cs/structure1.cs#1)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove cs/structure1.cs#1)].

<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
Expand Down Expand Up @@ -128,7 +128,12 @@
The following example instantiates a <xref:System.TimeSpan> object that represents the difference between two dates. It then displays the <xref:System.TimeSpan> object's properties.

[!code-csharp[System.TimeSpan.Class#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.timespan.class/cs/structure1.cs#1)]
[!code-vb[System.TimeSpan.Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.timespan.class/vb/structure1.vb#1)]
[!code-vb[System.TimeSpan.Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.timespan.class/vb/structure1.vb#1)]
<<<<<<< HEAD
[!code-powershell[System.Timespan.Class#1](~/samples/snippets/powershell/VS_Snippets_CLR_System/system.timespan.class/ps/structure1.ps1]
=======
[!code-powershell[System.Timespan.Class#1](~/samples/snippetspowershell/VS_Snippets_CLR_System/system.timespan.class/ps/structure1.ps1]
>>>>>>> 82e294c5709be80c8c994ce2bb7d90cc02f6860d
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@doctordns, this is a merge conflict that GitHub wanted you to resolve; it's marked off the two variants of the text. To resolve it, you determine which version of the text is the correct one (in this case, the first is). Then delete <<<<<<< HEAD , and delete the older variant as well as the GitHub tags:

======= 
[!code-powershell[System.Timespan.Class#1](~/samples/snippetspowershell/VS_Snippets_CLR_System/system.timespan.class/ps/structure1.ps1] 
>>>>>>> 82e294c5709be80c8c994ce2bb7d90cc02f6860d 


]]></format>
</remarks>
Expand Down