]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/fortran/doc/gfortran/intrinsic-procedures/fdate.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / fortran / doc / gfortran / intrinsic-procedures / fdate.rst
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. index:: FDATE, time, current, current time, date, current, current date
7
8 .. _fdate:
9
10 FDATE --- Get the current time as a string
11 ******************************************
12
13 .. function:: FDATE(DATE)
14
15 ``FDATE(DATE)`` returns the current date (using the same format as
16 :ref:`CTIME`) in :samp:`{DATE}`. It is equivalent to ``CALL CTIME(DATE,
17 TIME())``.
18
19 :param DATE:
20 The type shall be of type ``CHARACTER`` of the
21 default kind. It is an ``INTENT(OUT)`` argument. If the length of
22 this variable is too short for the date and time string to fit
23 completely, it will be blank on procedure return.
24
25 :return:
26 The current date and time as a string.
27
28 Standard:
29 GNU extension
30
31 Class:
32 Subroutine, function
33
34 Syntax:
35 .. code-block:: fortran
36
37 CALL FDATE(DATE).
38 DATE = FDATE().
39
40 Example:
41 .. code-block:: fortran
42
43 program test_fdate
44 integer(8) :: i, j
45 character(len=30) :: date
46 call fdate(date)
47 print *, 'Program started on ', date
48 do i = 1, 100000000 ! Just a delay
49 j = i * i - i
50 end do
51 call fdate(date)
52 print *, 'Program ended on ', date
53 end program test_fdate
54
55 See also:
56 :ref:`DATE_AND_TIME`,
57 :ref:`CTIME`