# get-date absolute value

**URL:** <https://forums.powershell.org/t/get-date-absolute-value/3244>\
**Category:** PowerShell Help\
**Created:** [October 13, 2014, 2:25pm UTC](https://forums.powershell.org/t/get-date-absolute-value/3244 "2014-10-13T14:25:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![garegin-asatryan](https://avatars.discourse-cdn.com/v4/letter/g/5e9695/32.png) [@garegin-asatryan](https://forums.powershell.org/u/garegin-asatryan)\
**Post date:** [October 13, 2014, 2:25pm UTC](https://forums.powershell.org/t/get-date-absolute-value/3244/1 "2014-10-13T14:25:09Z")

</div>

does get-date keep an absolute numerical value for a date and time starting from a specific date/epoch (ex. 1970). I know you can increment the get-time with a method. But I wanted to see how it compares two dates together.

---

<div class="post-metadata">

**Author:** ![daniel-krebs](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/daniel-krebs/32/484_2.png) [@daniel-krebs](https://forums.powershell.org/u/daniel-krebs)\
**Post date:** [October 13, 2014, 5:50pm UTC](https://forums.powershell.org/t/get-date-absolute-value/3244/2 "2014-10-13T17:50:07Z")

</div>

Every DateTime object returned by Get-Date has the Ticks property which is probably what you’re looking for.

```
PS C:\> (Get-Date).Ticks
635488748312963475
PS C:\> Get-Date | Get-Member -Name Ticks

   TypeName: System.DateTime

Name MemberType Definition

Ticks Property long Ticks {get;}
```

Source:[http://msdn.microsoft.com/en-us/library/system.datetime.ticks(v=vs.110).aspx](http://msdn.microsoft.com/en-us/library/system.datetime.ticks(v=vs.110).aspx)  
The value of this property represents the number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001

---

<div class="post-metadata">

**Author:** ![\_timpringle](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/_timpringle/32/276_2.png) [@\_timpringle](https://forums.powershell.org/u/_timpringle)\
**Post date:** [October 13, 2014, 6:07pm UTC](https://forums.powershell.org/t/get-date-absolute-value/3244/3 "2014-10-13T18:07:56Z")

</div>

Yes, numerical value of a datetime object is the number of 100 nanoseconds after Jan 1, 0001 AD.

---

<div class="post-metadata">

**Author:** ![garegin-asatryan](https://avatars.discourse-cdn.com/v4/letter/g/5e9695/32.png) [@garegin-asatryan](https://forums.powershell.org/u/garegin-asatryan)\
**Post date:** [October 14, 2014, 12:23pm UTC](https://forums.powershell.org/t/get-date-absolute-value/3244/4 "2014-10-14T12:23:36Z")

</div>

thanks for the answers. this question is also an academic one, as I am not solving a problem but want to understand powershell

when you do (get-date).datetime you can compare it to another date. how does powershell compare the dates from a value of say, Tuesday, October 14, 2014 9:42:57 PM? It that date an intelligent object that powershell knows its hidden numerical value or does it just read the string October 14 and know that it comes before November 5.?  
when I do a (get-date).datetime | gm I get a "Chars ParameterizedProperty char Chars(int index) {get;}. " Is that the clue to my question?

---

<div class="post-metadata">

**Author:** ![daniel-krebs](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/daniel-krebs/32/484_2.png) [@daniel-krebs](https://forums.powershell.org/u/daniel-krebs)\
**Post date:** [October 15, 2014, 7:30am UTC](https://forums.powershell.org/t/get-date-absolute-value/3244/5 "2014-10-15T07:30:29Z")

</div>

You’ll need to look into the DateTime implementation of the .NET Framework for the answer. The DateTime class is using the Ticks mentioned earlier to compare dates. What you need to understand is that PowerShell is build on top of the .NET Framework which provides most of the functionality.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:47pm UTC](https://forums.powershell.org/t/get-date-absolute-value/3244/6 "2024-05-16T20:47:19Z")

</div>

Closed on May 16, 2024, 8:47pm UTC


