## DateTime Utilities

DateTime Utilities — Functions to help working with GDateTime and HTTP

## Functions

GDateTime * | soup_date_time_new_from_http_string ()
char * | soup_date_time_to_string ()

## Types and Values

enum | SoupDateFormat

## Includes

    #include <libsoup/soup.h>

## Description

These are simple utility functions to help using GDateTime.

## Functions

### soup_date_time_new_from_http_string ()

    GDateTime *
    soup_date_time_new_from_http_string (const char *date_string);

Parses `date_string` and tries to extract a date from it. This recognizes all of the "HTTP-date" formats from RFC 2616, RFC 2822 dates, and reasonable approximations thereof. (Eg, it is lenient about whitespace, leading "0"s, etc.)

#### Parameters

date_string | The date as a string |

#### Returns

a new GDateTime, or `NULL` if `date_string` could not be parsed.

[nullable]

### soup_date_time_to_string ()

    char *
    soup_date_time_to_string (GDateTime *date,
                              SoupDateFormat format);

Converts `date` to a string in the format described by `format` .

Return: (transfer full): `date` as a string or `NULL`

#### Parameters

date | a GDateTime |
format | the format to generate the date in |

## Types and Values

### enum SoupDateFormat

Date formats that `soup_date_time_to_string()` can use.

`SOUP_DATE_HTTP` and `SOUP_DATE_COOKIE` always coerce the time to UTC.

This enum may be extended with more values in future releases.

#### Members

SOUP_DATE_HTTP | RFC 1123 format, used by the HTTP "Date" header. Eg "Sun, 06 Nov 1994 08:49:37 GMT" |
SOUP_DATE_COOKIE | The format for the "Expires" timestamp in the Netscape cookie specification. Eg, "Sun, 06-Nov-1994 08:49:37 GMT". |