Skip to content

Commit d9c8bb1

Browse files
committed
Mark DateTimeExtensions methods as obsolete DuendeSoftware/foss#56
1 parent e98187c commit d9c8bb1

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/content/docs/identitymodel/utils/epoch-time.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,27 @@ description: Learn about converting between DateTime and Unix/Epoch time formats
55
sidebar:
66
label: "Epoch Time"
77
order: 3
8+
badge:
9+
text: deprecated
10+
variant: note
811
redirect_from:
912
- /foss/identitymodel/utils/epoch_time/
1013
---
1114

12-
:::note
15+
:::note[Deprecation notice]
1316
Starting with .NET Framework 4.6 and .NET Core 1.0 this functionality is
1417
built-in via
15-
[DateTimeOffset.FromUnixTimeSeconds](https://docs.microsoft.com/en-us/dotnet/api/system.datetimeoffset.fromunixtimeseconds)
18+
[`DateTimeOffset.FromUnixTimeSeconds`](https://docs.microsoft.com/en-us/dotnet/api/system.datetimeoffset.fromunixtimeseconds)
1619
and
17-
[DateTimeOffset.ToUnixTimeSeconds](https://docs.microsoft.com/en-us/dotnet/api/system.datetimeoffset.tounixtimeseconds).
20+
[`DateTimeOffset.ToUnixTimeSeconds`](https://docs.microsoft.com/en-us/dotnet/api/system.datetimeoffset.tounixtimeseconds).
21+
22+
The `DateTimeExtensions` will be removed from Duende IdentityModel in the future.
1823
:::
1924

2025
JSON Web Token (JWT) tokens use so-called [Epoch or Unix time](https://en.wikipedia.org/wiki/Unix_time) to represent
2126
date/times, which is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT).
2227

23-
## DateTimeOffset To Epoch Time
28+
## DateTimeOffset To Epoch Time :badge[Obsolete]
2429

2530
In .NET, you can convert `DateTimeOffset` to Unix time via the two methods of `ToUnixTimeSeconds` and
2631
`ToUnixTimeMilliseconds`:
@@ -31,7 +36,7 @@ var seconds = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
3136
var milliseconds = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
3237
```
3338

34-
## DateTime To Epoch Time :badge[obsolete]
39+
## DateTime To Epoch Time :badge[Obsolete]
3540

3641
IdentityModel contains extensions methods for `DateTime` to convert
3742
to/from Unix time:

0 commit comments

Comments
 (0)