\hypertarget{dccaldatetochar_8f90}{}\section{dc\+\_\+utils/dccaldatetochar.f90 File Reference}
\label{dccaldatetochar_8f90}\index{dc\+\_\+utils/dccaldatetochar.\+f90@{dc\+\_\+utils/dccaldatetochar.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
character(string) function \hyperlink{dccaldatetochar_8f90_ad659830dc6e72d846b891f5e1567156c}{dccaldatetochar1} (year, month, day, hour, min, sec, zone)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{dccaldatetochar_8f90_ad659830dc6e72d846b891f5e1567156c}\label{dccaldatetochar_8f90_ad659830dc6e72d846b891f5e1567156c}} 
\index{dccaldatetochar.\+f90@{dccaldatetochar.\+f90}!dccaldatetochar1@{dccaldatetochar1}}
\index{dccaldatetochar1@{dccaldatetochar1}!dccaldatetochar.\+f90@{dccaldatetochar.\+f90}}
\subsubsection{\texorpdfstring{dccaldatetochar1()}{dccaldatetochar1()}}
{\footnotesize\ttfamily character(string) function dccaldatetochar1 (\begin{DoxyParamCaption}\item[{integer, intent(in)}]{year,  }\item[{integer, intent(in)}]{month,  }\item[{integer, intent(in)}]{day,  }\item[{integer, intent(in)}]{hour,  }\item[{integer, intent(in)}]{min,  }\item[{real(dp), intent(in)}]{sec,  }\item[{character($\ast$), intent(in), optional}]{zone }\end{DoxyParamCaption})}



Definition at line 17 of file dccaldatetochar.\+f90.



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


\begin{DoxyCode}
17   \textcolor{comment}{!}
18   \textcolor{comment}{! 年月日時分秒を文字型変数 (gtool4 netCDF 規約「5.5 日時形式」に準拠) }
19   \textcolor{comment}{! へ変換して返します.}
20   \textcolor{comment}{!}
21   \textcolor{comment}{! Convert year, month, day, hour, minute, second into a string}
22   \textcolor{comment}{! (conformed to gtool4 netCDF Convention}
23   \textcolor{comment}{! "5.5 Expression of date and time"). }
24   \textcolor{comment}{!}
25   \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}
26   \textcolor{keywordtype}{use }\hyperlink{namespacedc__string}{dc\_string}\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__string_1_1tochar}{tochar}, \hyperlink{interfacedc__string_1_1cprintf}{cprintf}, \hyperlink{interfacedc__string_1_1stoa}{stoa}, \hyperlink{interfacedc__string_1_1roundnum}{roundnum}
27   \textcolor{keywordtype}{use }\hyperlink{namespacedc__message}{dc\_message}\textcolor{keywordtype}{, only}: \hyperlink{interfacedc__message_1_1messagenotify}{messagenotify}
28   \textcolor{keywordtype}{implicit none}
29   \textcolor{keywordtype}{character(STRING)}:: result
30                               \textcolor{comment}{! 日時情報を表す文字列. }
31                               \textcolor{comment}{! 表示形式については gtool4 netCDF 規約}
32                               \textcolor{comment}{! 5.5 日時形式を参照のこと. }
33                               \textcolor{comment}{! }
34                               \textcolor{comment}{! Strings that express date and time. }
35                               \textcolor{comment}{! See gtool4 netCDF Convention }
36                               \textcolor{comment}{! 5.5 Expression of date and time for details. }
37   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}:: year                     \textcolor{comment}{! 年. Year.  }
38   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}:: month                    \textcolor{comment}{! 月. Month. }
39   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}:: day                      \textcolor{comment}{! 日. Day. }
40   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}:: hour                     \textcolor{comment}{! 時. Hour. }
41   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}:: min                      \textcolor{comment}{! 分. Minute. }
42   \textcolor{keywordtype}{real(DP)}, \textcolor{keywordtype}{intent(in)}:: sec                     \textcolor{comment}{! 秒. Sec. }
43   \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{optional}:: zone      \textcolor{comment}{! UTC からの時差. Time-zone. }
44   \textcolor{keywordtype}{integer}:: csec\_len
45   \textcolor{keywordtype}{character(TOKEN)}:: csec, zonew
46 \textcolor{keywordflow}{continue}
47 
48   \textcolor{keywordflow}{if} ( \textcolor{keyword}{present}(zone) ) \textcolor{keywordflow}{then}
49     zonew = zone
50   \textcolor{keywordflow}{else}
51     zonew = \textcolor{stringliteral}{''}
52 \textcolor{keywordflow}{  end if}
53 
54   csec = \hyperlink{interfacedc__string_1_1tochar}{tochar}(sec)
55   csec = \hyperlink{interfacedc__string_1_1roundnum}{roundnum}( csec )
56   \textcolor{keywordflow}{if} ( trim(csec) == \textcolor{stringliteral}{'-0.'} ) csec = \textcolor{stringliteral}{'0.'}
57   \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} ( index(\textcolor{stringliteral}{'123456789.'}, csec(len\_trim(csec):len\_trim(csec)) ) == 0 )
58     \textcolor{keywordflow}{if} ( len\_trim(csec) < 2 ) \textcolor{keywordflow}{exit}
59     csec = csec(1:len\_trim(csec)-1)
60 \textcolor{keywordflow}{  end do}
61   \textcolor{keywordflow}{if} (int(sec) > -1 .and. int(sec) < 10)  csec = \textcolor{stringliteral}{'0'} // csec
62   csec\_len = len(trim(adjustl(csec)))
63   \textcolor{keywordflow}{if} (csec(csec\_len:csec\_len) == \textcolor{stringliteral}{'.'}) csec = csec(1:csec\_len-1)
64 
65   result = \hyperlink{interfacedc__string_1_1cprintf}{cprintf}(\textcolor{stringliteral}{'%04d-%02d-%02dT%02d:%02d:%c%c'}, &
66     & i=(/year, month, day, hour, min/), &
67     & c1=trim(csec), c2=trim(zonew))
68 
\end{DoxyCode}
