---
name: "date_from_tm"
section: "3"
platform: "linux"
package: "libsynce0-dev"
version: "0.15-1.1"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/date_from_tm"
---

# date\_from\_tm(3)

convert between tm struct and Windows DATE value

## NAME

date\_from\_tm - convert between tm struct and Windows DATE value

## SYNOPSIS

```
#include <synce.h>

bool date_from_tm(struct tm *pTm, DATE *pDateOut);

bool date_to_tm(DATE dateIn, DWORD dwFlags, struct tm *pTm);
```

## DESCRIPTION

The **date\_from\_tm**() function converts a **tm** struct into the Windows **DATE** field pointed to by **pDateOut.** Only years after 1900 are converted. The fields tm.tm\_wday, tm.tm\_yday and tm.tm\_isdst are not used.

**date\_to\_tm**() does the reverse. It only fills the fields tm\_sec, tm\_min, tm\_hour, tm\_year, tm\_day, tm\_mon. Dates before January 1st 1900 are not supported. **dwFlags** should be 0, DATE\_TIMEVALUEONLY to omit the date information or DATE\_DATEVALUEONLY to omit time information. Whereas the **tm.tm\_year** field usually holds the number of years since 1900, this function provides the complete year.

## RETURN VALUE

Both functions return FALSE on encountering an invalid value or year earlier than 1900, or TRUE if successful.

## SEE ALSO

[**synce**(7)](/synce/7.md)
