88 liens privés
DateTime dateTime = DateTime.Now;
Console.WriteLine($"{dateTime.Kind} - {dateTime}");
string ianaParis = "Europe/Paris";
string ianaHavana = "America/Havana";
var i = dateTime.ToInstant(ianaParis);
Console.WriteLine(i);
Console.WriteLine(i.ToZoned(ianaParis));
Console.WriteLine(i.ToZoned(ianaHavana));
public static class Extensions
{
public static Instant ToInstant(this DateTime dateTime, string iana)
{
if (dateTime.Kind != DateTimeKind.Local)
{
throw new ArgumentException("Expected local kind of DateTime");
}
var tz = DateTimeZoneProviders.Tzdb[iana];
global::System.Console.WriteLine(DateTimeZoneProviders.Tzdb.VersionId);
var local = dateTime.ToLocalDateTime();
ZonedDateTime z = local.InZoneStrictly(tz);
return z.ToInstant();
}
public static ZonedDateTime ToZoned(this Instant instant, string iana)
{
var tz = DateTimeZoneProviders.Tzdb[iana];
return instant.InZone(tz);
}
}Alors qu’approchent les fêtes de Noël et les traditionnelles préparations de pâtisseries à la maison, l’UFC-Que Choisir publie un test exclusif sur les moules en silicone…
Tous les moules en silicones ne sont pas pour autant à proscrire. Notre test démontre en effet que certains fabricants comme Tefal ou Ikea (6) vendent des moules quasiment inertes vis-à-vis des aliments.
https://josef.codes/gotcha-when-using-postgres-nodatime-ef-core-and-dapper/
https://nodatime.org/3.1.x/userguide/concepts
https://www.youtube.com/watch?v=zl0h2J6a0w4
https://github.com/StevenRasmussen/EFCore.SqlServer.NodaTime
https://www.npgsql.org/efcore/mapping/nodatime.html
tt
Datetime with Kind UTC | timestamp with time zone
Datetime with Kind Local ou Unspecified | timestamp without time zone
timestamp without time zone (timestamp)
timestamp with time zone (timestamptz) + ajouter colonne string avec la timezone (IANA)
ZonedDateTime
It should also be pointed out that Noda Time has a representation called ZonedDateTime for this, while the .Net base class library does not have anything similar.
You would need to store both a DateTimeOffset and a TimeZoneInfo.Id value.
https://codeblog.jonskeet.uk/2019/03/27/storing-utc-is-not-a-silver-bullet/
https://codeopinion.com/just-store-utc-not-so-fast-handling-time-zones-is-complicated/
https://www.npgsql.org/doc/types/datetime.html
https://learn.microsoft.com/en-us/dotnet/api/system.datetime.touniversaltime?view=net-6.0
Castle Rock: Créé par Sam Shaw, Dustin Thomason. Avec Bill Skarsgård, André Holland, Lizzy Caplan, Melanie Lynskey. Inspirée des histoires de Stephen King, la série entremêle les personnages et les thèmes de la ville fictive de Castle Rock.
Learn about the new features in ASP.NET Core 7.0.
ASP.NET Core provides two primary methods allowing developers to cache information; IMemoryCache and IDistributedCache. Selecting the proper caching implementation requires an understanding of your application, your future goals, and the features of both options. This post explores cache strategies.
In this post I discuss C#'s nullable reference types in the context of Razor Pages, why they don't play nicely together and how to improve the experience.