Blog
急いてはことをレモン汁
About
適当なことが書かれています
あとpokemontdと
pokemontd2のプレイ日記らしきものが
pokemontd以外のゲーム記はこっち
ゲーム記
Profile
フリーのFlash制作ソフトParaFla!を使っていろいろ遊んでます
自由に生きていけたらなと
趣味はNHK鑑賞です
【欲しいもの】
お金、NHK教育の過去番組を好きなだけ自由に見れる権利
2019/01/24 23:47
'------------------------+'
'+ 共通モジュール
'+
'+ Name : dateFormat
'+
'+ 月や日が1桁の場合空白で充填する
'+ 引数
'+ a:日付項目(中身がNULLでも可)
'+ b:日付書式
'+
'+ 使い方
'+ dateFormat (now(),"yyyy/m/d日")→2018/ 9/ 5
'+ dateFormat (now(),"ggge(yyyy)年m月d日")→ 平成30(2018)年 9月11日
'+--------------------------------------------------------+'
Public Function dateFormat(a As Variant, b As String) As String
'If Nz(a, "") = "" or isDate(a)=false Then Exit Function
If Nz(a, "") <> "" And IsDate(a) = True Then
b = StrConv(b, vbLowerCase)
b = Replace(b, "ggg", Format(a, "ggg"))
b = Replace(b, "gg", Format(a, "gg"))
b = Replace(b, "g", Format(a, "g"))
b = Replace(b, "yyyy", Format(a, "yyyy"))
b = Replace(b, "ee", Format(a, "ee"))
b = Replace(b, "e", Format(Format(a, "e"), "@@"))
b = Replace(b, "mm", Format(a, "mm"))
b = Replace(b, "m", Format(Format(a, "m"), "@@"))
b = Replace(b, "dd", Format(a, "dd"))
b = Replace(b, "d", Format(Format(a, "d"), "@@"))
dateFormat = b
ElseIf Nz(a, "") = "" Then
b = StrConv(b, vbLowerCase)
b = Replace(b, "ggg", " ")
b = Replace(b, "gg", " ")
b = Replace(b, "g", " ")
b = Replace(b, "yyyy", " ")
b = Replace(b, "ee", " ")
b = Replace(b, "e", " ")
b = Replace(b, "mm", " ")
b = Replace(b, "m", " ")
b = Replace(b, "dd", " ")
b = Replace(b, "d", " ")
dateFormat = b
Else
Exit Function
End If
End Function