> For the complete documentation index, see [llms.txt](https://studentzone.gitbook.io/vuub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://studentzone.gitbook.io/vuub/the-guide/dates.md).

# Dates

All date utilities vuub provides.

## convertToUnixTimestamp()

**Description:** Provided a numbered Javascript date, this function will convert that date into a unix timestamp.\
**Parameters:** `convertToUnixTimestamp(numbered_js_date)`\
**Output Type:** Number (Unix Timestamp)\
**Code Snippet:**

```javascript
const { convertToUnixTimestamp, convertToUnixTimestampAsync } = require('vuub')

function SynchronousUsage () {
    
    // Option 1
    var currentTime = new Date().getTime()
    var convertedDate = convertToUnixTimestamp(currentTime) 
    console.log(convertedDate) // Output: 1639655680
     
    //Option 2
    var currentTime = Date.now()
    var convertedDate = convertToUnixTimestamp(currentTime)
    console.log(convertedDate) // Output: 1639655680
    
}

async function AsynchronousUsage () {
    
    // Option 1
    var currentTime = new Date().getTime()
    var convertedDate = await convertToUnixTimestampAsync(currentTime)
    console.log(convertedDate) // Output: 1639655680
    
    // Option 2
    var currentTime = Date.now()
    var convertedDate = await convertToUnixTimestampAsync(currentTime)
    console.log(convertedDate) // Output: 1639655680

}
```
