\hypertarget{dcdatetimetochar_8f90}{}\section{dc\+\_\+utils/dcdatetimetochar.f90 File Reference}
\label{dcdatetimetochar_8f90}\index{dc\+\_\+utils/dcdatetimetochar.\+f90@{dc\+\_\+utils/dcdatetimetochar.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
character(string) function \hyperlink{dcdatetimetochar_8f90_a154d1ece9f2ad27630c29bbc531289c8}{dcdatetimetochar} (time)
\item 
character(string) function \hyperlink{dcdatetimetochar_8f90_a95d3793dcef20fc4473c9f1d05f43aff}{dcdifftimetochar} (diff)
\item 
character(token) function \hyperlink{dcdatetimetochar_8f90_a066535bf2682040619e565d939fcf185}{dcdatetimetocharcal} (time, upcase)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{dcdatetimetochar_8f90_a154d1ece9f2ad27630c29bbc531289c8}\label{dcdatetimetochar_8f90_a154d1ece9f2ad27630c29bbc531289c8}} 
\index{dcdatetimetochar.\+f90@{dcdatetimetochar.\+f90}!dcdatetimetochar@{dcdatetimetochar}}
\index{dcdatetimetochar@{dcdatetimetochar}!dcdatetimetochar.\+f90@{dcdatetimetochar.\+f90}}
\subsubsection{\texorpdfstring{dcdatetimetochar()}{dcdatetimetochar()}}
{\footnotesize\ttfamily character(string) function dcdatetimetochar (\begin{DoxyParamCaption}\item[{type(dc\+\_\+datetime), intent(in)}]{time }\end{DoxyParamCaption})}



Definition at line 13 of file dcdatetimetochar.\+f90.



References dc\+\_\+types\+::dp, dc\+\_\+date\+\_\+types\+::hour\+\_\+seconds, dc\+\_\+date\+\_\+types\+::min\+\_\+seconds, dc\+\_\+types\+::string, dc\+\_\+types\+::token, and dc\+\_\+date\+\_\+types\+::year\+\_\+months.


\begin{DoxyCode}
13   \textcolor{comment}{!}
14   \textcolor{comment}{! dc\_date\_types#DC\_DATETIME 型変数を文字型変数へ変換して返します.}
15   \textcolor{comment}{! 書式は下記のように JIS X 0301 の完全表記です.}
16   \textcolor{comment}{!}
17   \textcolor{comment}{!   YYYY-MM-DDThh:mm:ss.sTZD}
18   \textcolor{comment}{!}
19   \textcolor{comment}{! YYYY は年, MM は月, DD は日, hh は時, mm は分, ss.s は秒,}
20   \textcolor{comment}{! TZD はタイムゾーンを表します.}
21   \textcolor{comment}{!}
22   \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_adb76910ff05e3b9fe3436567f8f8dac6}{string}, \hyperlink{namespacedc__types_a6d28eb015ba84292a06f4ff25165b376}{token}, \hyperlink{namespacedc__types_ac74a34430fcd3d0eb2344f19d536c086}{dp}
23   \textcolor{keywordtype}{use }dc\_string\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__date__generic_1_1tochar}{tochar}, cprintf, stoa
24   \textcolor{keywordtype}{use }\hyperlink{namespacedc__date__generic}{dc\_date\_generic}\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__date__generic_1_1eval}{eval}
25   \textcolor{keywordtype}{use }\hyperlink{namespacedc__date__types}{dc\_date\_types}\textcolor{keywordtype}{, only}: dc\_datetime, &
26     & \hyperlink{namespacedc__date__types_ab8d0e537d5aeeaaeb9c0023a54deeee4}{min\_seconds}, \hyperlink{namespacedc__date__types_a22b42c8ad86c45a1343d4c285277067d}{hour\_seconds}, \hyperlink{namespacedc__date__types_a94f04fc15c5b633e99505d4b1741e6bf}{year\_months}
27   \textcolor{keywordtype}{use }dc\_message\textcolor{keywordtype}{, only}: messagenotify
28   \textcolor{keywordtype}{implicit none}
29   \textcolor{keywordtype}{character(STRING)}:: result
30   \textcolor{keywordtype}{type}(dc\_datetime), \textcolor{keywordtype}{intent(in)}:: time
31 
32   \textcolor{keywordtype}{integer} :: year, mon, day, hour, \hyperlink{interfacedc__date__generic_1_1min}{min}, csec\_len
33   \textcolor{keywordtype}{real(DP)}:: sec
34   \textcolor{keywordtype}{character(TOKEN)} :: zone, csec
35 \textcolor{keywordflow}{continue}
36 
37   \textcolor{keyword}{call }\hyperlink{interfacedc__date__generic_1_1eval}{eval}(time, &
38     & year=year, mon=mon, day=day, hour=hour, \hyperlink{interfacedc__date__generic_1_1min}{min}=\hyperlink{interfacedc__date__generic_1_1min}{min}, sec=sec, zone=zone)
39 
40   csec = \hyperlink{interfacedc__date__generic_1_1tochar}{tochar}(sec)
41   \textcolor{keywordflow}{if} ( trim(csec) == \textcolor{stringliteral}{'-0.'} ) csec = \textcolor{stringliteral}{'0.'}
42   \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} ( index(\textcolor{stringliteral}{'123456789.'}, csec(len\_trim(csec):len\_trim(csec)) ) == 0 )
43     \textcolor{keywordflow}{if} ( len\_trim(csec) < 2 ) \textcolor{keywordflow}{exit}
44     csec = csec(1:len\_trim(csec)-1)
45 \textcolor{keywordflow}{  end do}
46   \textcolor{keywordflow}{if} (int(sec) > -1 .and. int(sec) < 10)  csec = \textcolor{stringliteral}{'0'} // csec
47   csec\_len = len(trim(adjustl(csec)))
48   \textcolor{keywordflow}{if} (csec(csec\_len:csec\_len) == \textcolor{stringliteral}{'.'}) csec = csec(1:csec\_len-1)
49 
50   result = cprintf(\textcolor{stringliteral}{'%04d-%02d-%02dT%02d:%02d:%c%c'}, &
51     & i=(/year, mon, day, hour, \hyperlink{interfacedc__date__generic_1_1min}{min}/), &
52     & c1=trim(csec), c2=trim(zone))
53 
\end{DoxyCode}
\mbox{\Hypertarget{dcdatetimetochar_8f90_a066535bf2682040619e565d939fcf185}\label{dcdatetimetochar_8f90_a066535bf2682040619e565d939fcf185}} 
\index{dcdatetimetochar.\+f90@{dcdatetimetochar.\+f90}!dcdatetimetocharcal@{dcdatetimetocharcal}}
\index{dcdatetimetocharcal@{dcdatetimetocharcal}!dcdatetimetochar.\+f90@{dcdatetimetochar.\+f90}}
\subsubsection{\texorpdfstring{dcdatetimetocharcal()}{dcdatetimetocharcal()}}
{\footnotesize\ttfamily character(token) function dcdatetimetocharcal (\begin{DoxyParamCaption}\item[{type(dc\+\_\+datetime), intent(in)}]{time,  }\item[{logical, intent(in), optional}]{upcase }\end{DoxyParamCaption})}



Definition at line 125 of file dcdatetimetochar.\+f90.



References dc\+\_\+date\+\_\+types\+::cal\+\_\+cyclic, dc\+\_\+date\+\_\+types\+::cal\+\_\+gregorian, dc\+\_\+date\+\_\+types\+::cal\+\_\+julian, dc\+\_\+date\+\_\+types\+::cal\+\_\+noleap, and dc\+\_\+types\+::token.


\begin{DoxyCode}
125   \textcolor{comment}{!}
126   \textcolor{comment}{! dc\_date\_types#DC\_DATETIME 型変数の暦を文字型にして返します. }
127   \textcolor{comment}{! 現在サポートされている暦は以下の通りです. }
128   \textcolor{comment}{! 左が暦を示す整数型変数, 右が返る文字列です. }
129   \textcolor{comment}{! *upcase* に .true. を与えた場合には, 大文字となって返ります. }
130   \textcolor{comment}{!}
131   \textcolor{comment}{! dc\_date\_types#CAL\_CYCLIC    :: cyclic}
132   \textcolor{comment}{! dc\_date\_types#CAL\_NOLEAP    :: noleap}
133   \textcolor{comment}{! dc\_date\_types#CAL\_JULIAN    :: julian}
134   \textcolor{comment}{! dc\_date\_types#CAL\_GREGORIAN :: gregorian}
135   \textcolor{comment}{!}
136   \textcolor{comment}{!}
137   \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_a6d28eb015ba84292a06f4ff25165b376}{token}
138   \textcolor{keywordtype}{use }dc\_present\textcolor{keywordtype}{, only}: present\_and\_true
139   \textcolor{keywordtype}{use }\hyperlink{namespacedc__date__types}{dc\_date\_types}\textcolor{keywordtype}{, only}: dc\_datetime, &
140     & \hyperlink{namespacedc__date__types_a3ce8040b3f1b4d71f8e6eb194811daed}{cal\_cyclic}, \hyperlink{namespacedc__date__types_a17e592b1b1e371849a4ff1a83a5cc55d}{cal\_noleap}, \hyperlink{namespacedc__date__types_afc0b0bf5152bfd5a33e2677afe1d16ee}{cal\_julian}, 
      \hyperlink{namespacedc__date__types_a9547e9bf73750e1ee9b19e5e9d45a74d}{cal\_gregorian}
141   \textcolor{keywordtype}{use }dc\_string\textcolor{keywordtype}{, only}: toupper
142   \textcolor{keywordtype}{character(TOKEN)} :: result
143   \textcolor{keywordtype}{type}(dc\_datetime), \textcolor{keywordtype}{intent(in)}:: time
144   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{optional}:: upcase
145 \textcolor{keywordflow}{continue}
146   \textcolor{keywordflow}{select case}( time % caltype )
147   \textcolor{keywordflow}{case}(\hyperlink{namespacedc__date__types_a3ce8040b3f1b4d71f8e6eb194811daed}{cal\_cyclic})
148     result = \textcolor{stringliteral}{'cyclic'}
149   \textcolor{keywordflow}{case}(\hyperlink{namespacedc__date__types_a17e592b1b1e371849a4ff1a83a5cc55d}{cal\_noleap})
150     result = \textcolor{stringliteral}{'noleap'}
151   \textcolor{keywordflow}{case}(\hyperlink{namespacedc__date__types_afc0b0bf5152bfd5a33e2677afe1d16ee}{cal\_julian})
152     result = \textcolor{stringliteral}{'julian'}
153   \textcolor{keywordflow}{case}(\hyperlink{namespacedc__date__types_a9547e9bf73750e1ee9b19e5e9d45a74d}{cal\_gregorian})
154     result = \textcolor{stringliteral}{'gregorian'}
155 \textcolor{keywordflow}{  case default}
156     result = \textcolor{stringliteral}{'none'}
157 \textcolor{keywordflow}{  end select}
158 
159   \textcolor{keywordflow}{if} ( present\_and\_true(upcase) ) \textcolor{keywordflow}{then}
160     \textcolor{keyword}{call }toupper(result) \textcolor{comment}{! (inout)}
161 \textcolor{keywordflow}{  end if}
162 
\end{DoxyCode}
\mbox{\Hypertarget{dcdatetimetochar_8f90_a95d3793dcef20fc4473c9f1d05f43aff}\label{dcdatetimetochar_8f90_a95d3793dcef20fc4473c9f1d05f43aff}} 
\index{dcdatetimetochar.\+f90@{dcdatetimetochar.\+f90}!dcdifftimetochar@{dcdifftimetochar}}
\index{dcdifftimetochar@{dcdifftimetochar}!dcdatetimetochar.\+f90@{dcdatetimetochar.\+f90}}
\subsubsection{\texorpdfstring{dcdifftimetochar()}{dcdifftimetochar()}}
{\footnotesize\ttfamily character(string) function dcdifftimetochar (\begin{DoxyParamCaption}\item[{type(dc\+\_\+difftime), intent(in)}]{diff }\end{DoxyParamCaption})}



Definition at line 58 of file dcdatetimetochar.\+f90.



References dc\+\_\+types\+::dp, dc\+\_\+types\+::string, and dc\+\_\+types\+::token.


\begin{DoxyCode}
58   \textcolor{comment}{!}
59   \textcolor{comment}{! dc\_date\_types#DC\_DIFFTIME 型変数を文字型変数へ変換して返します.}
60   \textcolor{comment}{! 書式は以下のようになります.}
61   \textcolor{comment}{!}
62   \textcolor{comment}{!   +YYYY-MM-DDThh:mm:ss.s}
63   \textcolor{comment}{!   -YYYY-MM-DDThh:mm:ss.s}
64   \textcolor{comment}{!}
65   \textcolor{comment}{! YYYY は年, MM は月, DD は日, hh は時, mm は分, ss.s は秒を表します.}
66   \textcolor{comment}{! ただし, DD は 2 桁を超える場合があります.}
67   \textcolor{comment}{! (dc\_date\_types#DC\_DIFFTIME は X ヶ月後, X 日前, などを表現するため}
68   \textcolor{comment}{! のデータ型なので, 日を月に繰り上げたり, 月を日に繰り下げることを}
69   \textcolor{comment}{! しません. また「年」の情報も持ちません. 1 年の日数や 1 月の日数は}
70   \textcolor{comment}{! dc\_date\_types#DC\_DATETIME 側で決まります).}
71   \textcolor{comment}{!}
72   \textcolor{comment}{! なお, DCDiffTimeCreate において, 単位を '1' とした場合は無時限時間と}
73   \textcolor{comment}{! 扱うため, 以下のような書式となります. }
74   \textcolor{comment}{! }
75   \textcolor{comment}{!   ss.s}
76   \textcolor{comment}{!}
77   \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_adb76910ff05e3b9fe3436567f8f8dac6}{string}, \hyperlink{namespacedc__types_a6d28eb015ba84292a06f4ff25165b376}{token}, \hyperlink{namespacedc__types_ac74a34430fcd3d0eb2344f19d536c086}{dp}
78   \textcolor{keywordtype}{use }dc\_string\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__date__generic_1_1tochar}{tochar}, cprintf, stoa
79   \textcolor{keywordtype}{use }\hyperlink{namespacedc__date__generic}{dc\_date\_generic}\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__date__generic_1_1eval}{eval}
80   \textcolor{keywordtype}{use }\hyperlink{namespacedc__date__types}{dc\_date\_types}\textcolor{keywordtype}{, only}: dc\_difftime
81   \textcolor{keywordtype}{use }\hyperlink{namespacedc__scaledsec}{dc\_scaledsec}\textcolor{keywordtype}{, only}: \textcolor{keyword}{assignment}(=)
82   \textcolor{keywordtype}{implicit none}
83   \textcolor{keywordtype}{character(STRING)}:: result
84   \textcolor{keywordtype}{type}(dc\_difftime), \textcolor{keywordtype}{intent(in)}:: diff
85 
86   \textcolor{keywordtype}{integer} :: year, mon, day, hour, \hyperlink{interfacedc__date__generic_1_1min}{min}, csec\_len
87   \textcolor{keywordtype}{real(DP)}:: sec
88   \textcolor{keywordtype}{character(TOKEN)} :: csec
89   \textcolor{keywordtype}{character(1)} :: pm
90 \textcolor{keywordflow}{continue}
91 
92   \textcolor{keywordflow}{if} ( .not. diff % nondim\_flag ) \textcolor{keywordflow}{then}
93     \textcolor{keyword}{call }\hyperlink{interfacedc__date__generic_1_1eval}{eval}(diff, year=year, mon=mon, day=day, hour=hour, \hyperlink{interfacedc__date__generic_1_1min}{min}=\hyperlink{interfacedc__date__generic_1_1min}{min}, sec=sec)
94 
95     \textcolor{keywordflow}{if} ( year < 0 .or. mon < 0 .or. day < 0 .or.  &
96       &  hour < 0 .or. \hyperlink{interfacedc__date__generic_1_1min}{min} < 0 .or. sec < 0         ) \textcolor{keywordflow}{then}
97       year=abs(year) ; mon=abs(mon) ; day=abs(day)
98       hour=abs(hour) ; \hyperlink{interfacedc__date__generic_1_1min}{min}=abs(\hyperlink{interfacedc__date__generic_1_1min}{min}) ; sec=abs(sec)
99       pm = \textcolor{stringliteral}{'-'}
100     \textcolor{keywordflow}{else}
101       pm = \textcolor{stringliteral}{'+'}
102 \textcolor{keywordflow}{    end if}
103 
104     csec = \hyperlink{interfacedc__date__generic_1_1tochar}{tochar}(sec)
105     \textcolor{keywordflow}{if} ( trim(csec) == \textcolor{stringliteral}{'-0.'} ) csec = \textcolor{stringliteral}{'0.'}
106     \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} ( index(\textcolor{stringliteral}{'123456789.'}, csec(len\_trim(csec):len\_trim(csec)) ) == 0 )
107       \textcolor{keywordflow}{if} ( len\_trim(csec) < 2 ) \textcolor{keywordflow}{exit}
108       csec = csec(1:len\_trim(csec)-1)
109 \textcolor{keywordflow}{    end do}
110     \textcolor{keywordflow}{if} (int(sec) > -1 .and. int(sec) < 10)  csec = \textcolor{stringliteral}{'0'} // csec
111     csec\_len = len(trim(adjustl(csec)))
112     \textcolor{keywordflow}{if} (csec(csec\_len:csec\_len) == \textcolor{stringliteral}{'.'}) csec = csec(1:csec\_len-1)
113 
114     result = cprintf(\textcolor{stringliteral}{'%c%04d-%02d-%02dT%02d:%02d:%c'}, &
115       & i=(/year, mon, day, hour, \hyperlink{interfacedc__date__generic_1_1min}{min}/), &
116       & c1=pm, c2=trim(csec))
117   \textcolor{keywordflow}{else}
118     sec = diff % sec
119     result = \hyperlink{interfacedc__date__generic_1_1tochar}{tochar}( sec )
120 \textcolor{keywordflow}{  end if}
121 
\end{DoxyCode}
