新元号

新元号は令和
Accessには和暦はあるのでそのうちupdateあるでしょう
SQLserverとVB.NETにはない → 失礼、VB.NETにはあります
SQLserverのスカラー関数を
前略
DECLARE @ResultVar nvarchar(10),@VarYear int,@VarDate nvarchar(10),@VarDateInt int

select @VarYear=cast(format(@paramDate,’yyyy’) as int)
select @VarDate=format(@paramDate,’MM/dd’)
select @VarDateInt=cast(format(@paramDate,’yyyyMMdd’) as int)

— Add the T-SQL statements to compute the return value here
select @ResultVar=(case
when @VarDateint>20190430 then
concat(‘R’,format((@VarYear-2018),’00’),’/’,@VarDate) –令和
when @VarDateInt>19890107 then
concat(‘H’,format((@varyear-1988),’00’),’/’,@VarDate) –平成
when @VarDateInt>19261224 then
concat(‘S’,format((@varyear-1925),’00’),’/’,@VarDate) –昭和
when @VarDateInt>19120729 then
concat(‘T’,format((@varyear-1911),’00’),’/’,@VarDate) –大正
when @VarDateInt>18680124 then
concat(‘M’,format((@varyear-1867),’00’),’/’,@VarDate) –明治
else ‘0’
end
)
— Return the result of the function
RETURN @ResultVar
以下略
これで良いはず
SQLserverにあればVSはなんとかなるでしょう
VB.NETには和暦あります。省略型はないですが。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です