Home Explore Blog CI



postgresql

100th chunk of `doc/src/sgml/ecpg.sgml`
e3ff94f3082cb61b10a02b59f3407e9f25b410a93570460c0000000100000fa8
 the current date.
       </para>
       <para>
        Internally this function uses the <xref linkend="pgtypesdatetoday"/>
        function.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-informix-functions-rjulmdy">
      <term><function>rjulmdy</function></term>
      <listitem>
       <para>
        Extract the values for the day, the month and the year from a variable
        of type date.
<synopsis>
int rjulmdy(date d, short mdy[3]);
</synopsis>
        The function receives the date <literal>d</literal> and a pointer to an array
        of 3 short integer values <literal>mdy</literal>. The variable name indicates
        the sequential order: <literal>mdy[0]</literal> will be set to contain the
        number of the month, <literal>mdy[1]</literal> will be set to the value of the
        day and <literal>mdy[2]</literal> will contain the year.
       </para>
       <para>
        The function always returns 0 at the moment.
       </para>
       <para>
        Internally the function uses the <xref linkend="pgtypesdatejulmdy"/>
        function.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-informix-functions-rdefmtdate">
      <term><function>rdefmtdate</function></term>
      <listitem>
       <para>
        Use a format mask to convert a character string to a value of type
        date.
<synopsis>
int rdefmtdate(date *d, char *fmt, char *str);
</synopsis>
        The function receives a pointer to the date value that should hold the
        result of the operation (<literal>d</literal>), the format mask to use for
        parsing the date (<literal>fmt</literal>) and the C char* string containing
        the textual representation of the date (<literal>str</literal>). The textual
        representation is expected to match the format mask. However you do not
        need to have a 1:1 mapping of the string to the format mask. The
        function only analyzes the sequential order and looks for the literals
        <literal>yy</literal> or <literal>yyyy</literal> that indicate the
        position of the year, <literal>mm</literal> to indicate the position of
        the month and <literal>dd</literal> to indicate the position of the
        day.
       </para>
       <para>
        The function returns the following values:
        <itemizedlist>
         <listitem>
          <para>
           0 - The function terminated successfully.
          </para>
         </listitem>
         <listitem>
          <para>
           <literal>ECPG_INFORMIX_ENOSHORTDATE</literal> - The date does not contain
           delimiters between day, month and year. In this case the input
           string must be exactly 6 or 8 bytes long but isn't.
          </para>
         </listitem>
         <listitem>
          <para>
           <literal>ECPG_INFORMIX_ENOTDMY</literal> - The format string did not
           correctly indicate the sequential order of year, month and day.
          </para>
         </listitem>
         <listitem>
          <para>
           <literal>ECPG_INFORMIX_BAD_DAY</literal> - The input string does not
           contain a valid day.
          </para>
         </listitem>
         <listitem>
          <para>
           <literal>ECPG_INFORMIX_BAD_MONTH</literal> - The input string does not
           contain a valid month.
          </para>
         </listitem>
         <listitem>
          <para>
           <literal>ECPG_INFORMIX_BAD_YEAR</literal> - The input string does not
           contain a valid year.
          </para>
         </listitem>
        </itemizedlist>
       </para>
       <para>
        Internally this function is implemented to use the <xref
        linkend="pgtypesdatedefmtasc"/> function. See the reference there for a
        table of example input.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-informix-functions-rfmtdate">
      <term><function>rfmtdate</function></term>
      <listitem>

Title: Informix Date Conversion Functions: rjulmdy and rdefmtdate
Summary
This section describes the `rjulmdy` function, which extracts the day, month, and year from a date variable into an array, and the `rdefmtdate` function, which converts a character string to a date using a specified format mask, detailing the expected input format and potential error codes.