SrchVali.sgm 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <!-- $XConsortium: dtsrvald.sgm 1996 -->
  2. <!-- (c) Copyright 1995 Digital Equipment Corporation. -->
  3. <!-- (c) Copyright 1995 Hewlett-Packard Company. -->
  4. <!-- (c) Copyright 1995 International Business Machines Corp. -->
  5. <!-- (c) Copyright 1995 Sun Microsystems, Inc. -->
  6. <!-- (c) Copyright 1995 Novell, Inc. -->
  7. <!-- (c) Copyright 1995 FUJITSU LIMITED. -->
  8. <!-- (c) Copyright 1995 Hitachi. -->
  9. <![ %CDE.C.CDE; [<refentry id="CDE.SEARCH.DtSearchValidDateStri">]]>
  10. <refmeta>
  11. <refentrytitle>DtSearchValidDateString</refentrytitle>
  12. <manvolnum>library call</manvolnum></refmeta>
  13. <refnamediv>
  14. <refname><function>DtSearchValidDateString</function>
  15. </refname>
  16. <refpurpose>Validate and convert a user date string
  17. </refpurpose>
  18. </refnamediv>
  19. <refsynopsisdiv>
  20. <funcsynopsis>
  21. <funcsynopsisinfo>#include &lt;Dt/Search.h></funcsynopsisinfo>
  22. <funcdef>DtSrObjdate <function>DtSearchValidDateString</function></funcdef>
  23. <paramdef>char *<parameter>date_string</parameter></paramdef>
  24. </funcsynopsis>
  25. </refsynopsisdiv><refsect1>
  26. <title>DESCRIPTION</title>
  27. <para><function>DtSearchValidDateString</function> validates a DtSearch date
  28. string, as might have been entered by a user in a free form text field,
  29. and converts it into a valid <structname role="typedef">DtSrObjdate</structname>.
  30. </para>
  31. <para>Since an invalid date string format returns a distinctive <structname role="typedef">DtSrObjdate</structname>, this function may also be used as
  32. a boolean test for string validity.
  33. </para>
  34. </refsect1><refsect1>
  35. <title>ARGUMENTS</title>
  36. <variablelist>
  37. <varlistentry><term><symbol role="Variable">date_string</symbol></term>
  38. <listitem>
  39. <para>Specifies the date string to be validated and converted.
  40. </para>
  41. <para>The format for a valid date string is "[<emphasis>yyyy</emphasis>
  42. [<emphasis>mm</emphasis> [<emphasis>dd</emphasis>]]", one, two, or three
  43. ASCII numeric tokens separated by one or more nonnumeric chars
  44. (whitespace, slashes, etc). The integer <emphasis>yyyy</emphasis>
  45. represents a Gregorian calendar year number in the range 1990 to 5995
  46. inclusive. If <emphasis>yyyy</emphasis> is less than 1900, 1900 is added
  47. to it. The integer <emphasis>mm</emphasis> is a Gregorian calendar month
  48. number in the range 1 to 12 inclusive. The integer
  49. <emphasis>dd</emphasis> is a Gregorian calendar day number in the range
  50. 1 to 31 inclusive.
  51. </para>
  52. <para>If only two tokens are in the string, they are presumed to be
  53. <emphasis>yyyy</emphasis> and <emphasis>mm</emphasis>, and
  54. <emphasis>dd</emphasis> is presumed to be to 1.
  55. </para>
  56. <para>If only one token is in the string, it is presumed to be
  57. <emphasis>yyyy</emphasis>, and both <emphasis>mm</emphasis>
  58. and <emphasis>dd</emphasis> are presumed to be 1.
  59. </para>
  60. </listitem>
  61. </varlistentry>
  62. </variablelist>
  63. </refsect1>
  64. <refsect1>
  65. <title>RETURN VALUE</title>
  66. <para><function>DtSearchValidDateString</function> returns zero (a valid
  67. <structname role="typedef">DtSrObjdate</structname>) if
  68. <symbol role="Variable">date_string</symbol> is NULL or empty.
  69. </para>
  70. <para>It returns a correctly formatted <structname role="typedef">DtSrObjdate</structname> on successful parse and
  71. conversion.
  72. </para>
  73. <para>It returns -1 and a message on the MessageList if
  74. <symbol role="Variable">date_string</symbol> is invalid.
  75. </para>
  76. </refsect1>
  77. <refsect1>
  78. <Title>SEE ALSO</Title>
  79. <para>&cdeman.DtSrAPI;,
  80. &cdeman.DtSearchQuery;,
  81. &cdeman.dtsrfzkfiles;,
  82. &cdeman.DtSearch;
  83. </para>
  84. </refsect1></refentry>