curl_getdate.3 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. .\" You can view this file with:
  2. .\" nroff -man [file]
  3. .\" $Id: curl_getdate.3,v 1.2 2004/02/27 15:34:06 bagder Exp $
  4. .\"
  5. .TH curl_getdate 3 "5 March 2001" "libcurl 7.0" "libcurl Manual"
  6. .SH NAME
  7. curl_getdate - Convert an date in a ASCII string to number of seconds since
  8. January 1, 1970
  9. .SH SYNOPSIS
  10. .B #include <curl/curl.h>
  11. .sp
  12. .BI "time_t curl_getdate(char *" datestring ", time_t *"now" );
  13. .ad
  14. .SH DESCRIPTION
  15. This function returns the number of seconds since January 1st 1970, for the
  16. date and time that the
  17. .I datestring
  18. parameter specifies. The
  19. .I now
  20. parameter is there and should hold the current time to allow the datestring to
  21. specify relative dates/times. Read further in the date string parser section
  22. below.
  23. .SH PARSING DATES AND TIMES
  24. A "date" is a string, possibly empty, containing many items separated by
  25. whitespace. The whitespace may be omitted when no ambiguity arises. The
  26. empty string means the beginning of today (i.e., midnight). Order of the
  27. items is immaterial. A date string may contain many flavors of items:
  28. .TP 0.8i
  29. .B calendar date items
  30. This can be specified in a number of different ways. Including 1970-09-17, 70-9-17, 70-09-17, 9/17/72, 24 September 1972, 24 Sept 72, 24 Sep 72, Sep 24, 1972, 24-sep-72, 24sep72.
  31. The year can also be omitted, for example: 9/17 or "sep 17".
  32. .TP
  33. .B time of the day items
  34. This string specifies the time on a given day. Syntax supported includes:
  35. 18:19:0, 18:19, 6:19pm, 18:19-0500 (for specifying the time zone as well).
  36. .TP
  37. .B time zone items
  38. Specifies international time zone. There are a few acronyms supported, but in
  39. general you should instead use the specific realtive time compared to
  40. UTC. Supported formats include: -1200, MST, +0100.
  41. .TP
  42. .B day of the week items
  43. Specifies a day of the week. If this is mentioned alone it means that day of
  44. the week in the future.
  45. Days of the week may be spelled out in full: `Sunday', `Monday', etc or they
  46. may be abbreviated to their first three letters, optionally followed by a
  47. period. The special abbreviations `Tues' for `Tuesday', `Wednes' for
  48. `Wednesday' and `Thur' or `Thurs' for `Thursday' are also allowed.
  49. A number may precede a day of the week item to move forward supplementary
  50. weeks. It is best used in expression like `third monday'. In this context,
  51. `last DAY' or `next DAY' is also acceptable; they move one week before or
  52. after the day that DAY by itself would represent.
  53. .TP
  54. .B relative items
  55. A relative item adjusts a date (or the current date if none) forward or
  56. backward. Example syntax includes: "1 year", "1 year ago", "2 days", "4
  57. weeks".
  58. The string `tomorrow' is worth one day in the future (equivalent to `day'),
  59. the string `yesterday' is worth one day in the past (equivalent to `day ago').
  60. .TP
  61. .B pure numbers
  62. If the decimal number is of the form YYYYMMDD and no other calendar date item
  63. appears before it in the date string, then YYYY is read as the year, MM as the
  64. month number and DD as the day of the month, for the specified calendar date.
  65. .PP
  66. .SH RETURN VALUE
  67. This function returns zero when it fails to parse the date string. Otherwise
  68. it returns the number of seconds as described.
  69. .SH AUTHORS
  70. Originally written by Steven M. Bellovin <smb@research.att.com> while at the
  71. University of North Carolina at Chapel Hill. Later tweaked by a couple of
  72. people on Usenet. Completely overhauled by Rich $alz <rsalz@bbn.com> and Jim
  73. Berets <jberets@bbn.com> in August, 1990.
  74. It has been modified extensively since imported to curl.
  75. .SH "SEE ALSO"
  76. .BR GNU date(1)