Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
日付と闘う-和暦は難しい / vs Dates - Japanese Chronology i...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
wkwkhautbois
June 16, 2024
Programming
2.3k
1
Share
日付と闘う-和暦は難しい / vs Dates - Japanese Chronology is Difficult
JJUG CCC 2024 Spring 懇親会LT スライド
Javaで和暦を扱うときの どうして(´・ω・`)ショボーン について
wkwkhautbois
June 16, 2024
More Decks by wkwkhautbois
See All by wkwkhautbois
JavaとKotlinで例外処理の相性が悪いなと思った瞬間(2023/09/29 Server-Side Kotlin Meetup vol.10 )
wkwkhautbois
0
880
Other Decks in Programming
See All in Programming
WebAssembly を読み込むベストプラクティス 2026年春版 / Best Practices for Loading WebAssembly (Spring 2026)
petamoriken
5
1.1k
🦞OpenClaw works with AWS
licux
1
370
【ディップ|26年新卒研修資料】TDD実装演習
dip_tech
PRO
0
210
Cloudflare で始める Data Platform
ta93abe
0
190
AlarmKitで明後日起きれるアラームアプリを作る
trickart
0
140
関係性から理解する"同一性"の型用語たち
pvcresin
1
250
~ 秘伝のタレ化した『神スプシ』と戦う ~ 関数型パラダイムで壊れない仕組みへ
h0r15h0
1
100
リセットCSSを1行消したらアクセシビリティが向上した話
pvcresin
4
520
tsserverとは何だったのか_これからどうなるのか
nowaki28
0
230
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
2
200
ソースコード→AST→オペコード、の旅を覗いてみる
o0h
PRO
1
140
実践ハーネスエンジニアリング:ステアリングループを実例から読み解く / Practical Harness Engineering: Understanding Steering Loops Through Real-World Examples
nrslib
5
5.7k
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.6k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.5k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
110k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
530
KATA
mclloyd
PRO
35
15k
HDC tutorial
michielstock
2
660
So, you think you're a good person
axbom
PRO
2
2k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Transcript
⽇付と闘う - 和暦は難しい - わくわく JJUG CCC 2024 Spring 懇親会LT
1
⾃⼰紹介 • 名前 • わくわく • 仕事 • シェルフィー株式会社 •
建設業界向けのSaaS事業 X(Twitter) ブログ https://wkwkhautbois.hatenablog.jp/ @wkwk_hautbois https://zenn.dev/wkwkhautbois Zenn 2
建設業界は 法律・必要な資格がたくさん 3
そんなとき登場するのが…? 4
令和6年6⽉16⽇ 和暦 5
JapaneseDate (以降これ使う前提で進めます) 6
平成はいつまで? ところで 7
平成はいつまで? 2019-04-30 平成31年4⽉30⽇ ところで 8
平成33年7⽉8⽇まで有効 改元の話題が出る前 いい感じに扱えないか 9
parse してから format してみる 10
平成31年5⽉1⽇ JapaneseDate.from(fmt.parse("平成31年5⽉1⽇")).format(fmt)) 11
平成31年5⽉1⽇ ↓ 令和1年5⽉1⽇ JapaneseDate.from(fmt.parse("平成31年5⽉1⽇")).format(fmt)) 👏 12
平成33年7⽉8⽇ JapaneseDate.from(fmt.parse("平成33年7⽉8⽇")).format(fmt)) 13
平成33年7⽉8⽇ ↓ 令和3年7⽉8⽇ JapaneseDate.from(fmt.parse("平成33年7⽉8⽇")).format(fmt)) DateTimeParseException 14 最後に 追記あり
どうして(´・ω・`) 15 最後に 追記あり
次は ⼯事現場にて 16
建設業の許可票 商号⼜は名称 代表者の⽒名 ... ... 許可番号 許可年⽉⽇ 東京都知事 許可(1)第99999号 R1.05.27
⼯事現場にあるやつ 17
建設業の許可票 商号⼜は名称 代表者の⽒名 ... ... 許可番号 許可年⽉⽇ 東京都知事 許可(1)第99999号 R1.05.27
⼯事現場にあるやつ 許可年度 18
年⽉⽇から 年度を求めるには? 19
わりと強引に... if(許可⽉ < 4) { // 許可年 ‒ 1 //
etc. } else { // 許可年 } 20
⾃治体によって 表記に揺れがあったりする 平成31年度 or 令和1年度 21
どうして(´・ω・`) 22
ふたたび資格 23
ふたたび資格 有効期限が年末まで 24
TemporalAdjusters.lastDayOfYear() 25
今⽇ 26
今⽇ ↓ 令和6年12⽉31⽇ 27
平成31年1⽉1⽇ 28
平成31年1⽉1⽇ ↓ 平成31年4⽉30⽇❗ 29 最後に 追記あり
令和1年5⽉1⽇ 30
令和1年5⽉1⽇ ↓ 令和1年9⽉2⽇ ⁉ 5/1〜12/31までの⽇数を 1/1に⾜している 31 最後に 追記あり
どうして(´・ω・`) 32 最後に 追記あり
和暦は難しい 33
⽇付と闘う おわり 和暦 追記へ
X(Twitter)で 挙動の説明をいただきました 35 追記
36 追記
37 追記
⽇付と闘う おわり 和暦 闘う仲間 募集中! https://hello.shelfy.co.jp/ 38 追記