問題タブ [threetenbp]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
android - ゾーンをロードせずにLocalDateTimeをUTCに変換して戻す方法は?
バックグラウンド
さまざまな時間関連のデータ操作を処理するために、Android 用のthreetenbp バックポート( here )を使用しています。
それらの 1 つは、時刻を別のタイムゾーンに変換することです (現在の UTC とその逆)。
次のようなものを使用すると、これが可能になることがわかります。
これは問題なく機能し、逆の操作も非常に簡単です。
問題
ライブラリの初期化を回避しようとしています。これにより、ゾーンのかなり大きなファイルがライブラリにロードされます。これを使わずにさまざまな日付/時刻関連の操作を処理する方法を既に理解しています。ただし、UTC に変換して元に戻す場合は除きます。
私が得たものには、正しい変換から 1 時間ずれているエラーがあります。
私が試したこと
これは私が見つけて試したものです:
質問
私が書いたことの正確な何が問題なのですか?ライブラリを初期化せずに時間を変換するための代替コードを取得するにはどうすればよいですか?
入力として LocalDateTime のインスタンスが与えられた場合、それを現在のタイムゾーンから UTC に、および UTC から現在のタイムゾーンに変換するにはどうすればよいですか?
kotlin - How to calculate minutes of the day from a UTC milliseconds value w/o time zone offset?
Given the following time stamp ...
which corresponds to ..
I like to calculate the amount of minutes of the day using the ThreeTen backport library:
Above works so far.
Is there a way to avoid defining the zone offset since the UTC milliseconds already implicitly the zone offset of 0?
Related
- https://www.epochconverter.com - for getting the milliseconds value