0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

時差勘案について調べてみた

Last updated at Posted at 2022-04-30

はじめに

時差勘案を考慮する際にどこで何が必要かを調べたときのメモ
 ※直近は何もしなくても大丈夫だったけど、今後使うことがあった場合にすぐに確認できるように...

キーワード

i18n/ロケール(Locale)/タイムゾーン(Timezone)

参考サイト

◆C#で日時データをタイムゾーンをまたいで正しく変換する方法
 https://qiita.com/katz/items/d0cad9bfee79ef10ec5c

Kindの値 意味
DateTimeKind.Utc UTCの時刻を保持
DateTimeKind.Local ローカル時刻を保持
DateTimeKind.Unspecified UTCやローカル時刻ではない時刻を保持(★既定値)

◆C#(.NET Core 3.1, .NET 6)のランタイム上のシステムタイムゾーンを置き換えたい(TimeZoneInfo.LocalがUTCを返すようにしたい)
 https://qiita.com/fukasawah/items/c42b586745be56fed674

◆.Net6 + Npgsql.EntityFrameworkCore.PostgreSQL(Ver6.0)にしたらハマったこと
 https://qiita.com/k-yamamoto/items/a87989569cb6f0415fbb
  ※こういうのがあると簡単にバージョンアップできないんだよな...
   対策も書いてあるので助かる

◆PostgreSQLのTIMESTAMP WITH TIME ZONE型は.NETのDateTimeOffset型ではなくDateTime型を使う
 https://qiita.com/kkino90h/items/147aed6162c82a1022f9
  ※PostgreSQLを使っているわけではないのだが...Denodoみたいにデータ仮想化したら考えないといけないなぁ~

◆NuGet Gallery | Npgsql 7.0.4
 https://www.nuget.org/packages/Npgsql/
  ※調べた時点でv8もある...

◆GitHub - npgsql/npgsql: Npgsql is the .NET data provider for PostgreSQL.
 https://github.com/npgsql/npgsql
  ※内部の動きを見るためにはこちらをダウンロードしてコード見ないと...

◆Npgsql 6 converts DateTime.UtcNow to local time during insert for timestamp without time zone column
 https://github.com/npgsql/npgsql/issues/4208
  ※v5/v6で試した結果が書かれているので助かる...

◆4.4.2 アプリケーションのデータ型とデータベースのデータ型の関係
 https://software.fujitsu.com/jp/manual/manualfiles/m170009/j2ul2244/01z200/j2244-00-04-04-02.html
  ※こういう一覧であると後で助かる...

◆【PostgreSQL】NpgsqlでTimestampTZは基本使わない
 http://www.madeinclinic.jp/%E3%83%87%E3%83%BC%E3%82%BF%E3%83%99%E3%83%BC%E3%82%B9/20200414/
  ※「C# で Npgsqlを使ってtimestamp with time zoneのデータをinsertしていて、insertされた結果が9時間進んでいるという謎現象が起きて、しばらくはまったのでメモ。」だそうです...

◆Connection String Parameters | Npgsql Documentation
 https://www.npgsql.org/doc/connection-string-parameters.html
  ※Timezone(Default:PGTZ = 'Asia/Tokyo')というオプション有
  ★'Asia/Tokyo'は、後述の「タイムゾーンの一覧」のサイトにある、タイムゾーンID


◆タイムゾーン一覧
 https://www.jisakeisan.com/
◆タイムゾーンの一覧
 https://jp.cybozu.help/general/ja/admin/list_systemadmin/list_localization/timezone.html
◆サマータイムを処理するには?[.NET 3.5、C#/VB]
 https://www.atmarkit.co.jp/ait/articles/1809/05/news015.html#isdaylightsavingtime
◆サマータイムを考慮した PowerShell での時刻ハンドリング
 http://www.vwnet.jp/Windows/PowerShell/2018090501/DateTimeOffset.htm
◆アメリカ / ニューヨークの時差と現在時刻 - Time-j.net
 https://www.time-j.net/worldtime/location/america/new_york
◆Jenkinsのスケジュール実行をシステムのタイムゾーンとは、異なるタイムゾーンで実行する。
 https://dev.classmethod.jp/articles/run_job_scheduled_different_timezone/

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?