{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Date Functions","description":"Developer documentation for the WHMCS API — the","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"date-functions","__idx":0},"children":["Date Functions"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following date helper functions are made available to make it easier to work with dates in WHMCS."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"todays-date","__idx":1},"children":["Todays Date"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"/**\n * Returns todays date\n *\n * By default returns the format defined in General Settings > Localisation > Date Format\n *\n * @param bool $applyClientDateFormat Set true to apply Localisation > Client Date Format\n *\n * @return string\n */\n$todaysdate = getTodaysDate($applyClientDateFormat);\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"from-mysql-date","__idx":2},"children":["From MySQL Date"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"/**\n * Formats a MySQL Date/Timestamp value to system settings\n *\n * @param string $datetimestamp The MySQL Date/Timestamp value\n * @param bool $includeTime Pass true to include the time in the result\n * @param bool $applyClientDateFormat Set true to apply Localisation > Client Date Format\n *\n * @return string\n */\n$date = fromMySQLDate($date, $includeTime, $applyClientDateFormat);\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"to-mysql-date","__idx":3},"children":["To MySQL Date"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"/**\n * Converts a date entered in the system setting format to a MySQL Date/Timestamp\n *\n * @param string $userInputDate\n *\n * @return string Format: 2016-12-30 23:59:59\n */\n$date = toMySQLDate($date);\n"},"children":[]}]},"headings":[{"value":"Date Functions","id":"date-functions","depth":1},{"value":"Todays Date","id":"todays-date","depth":2},{"value":"From MySQL Date","id":"from-mysql-date","depth":2},{"value":"To MySQL Date","id":"to-mysql-date","depth":2}],"frontmatter":{"title":"Date Functions","seo":{"title":"Date Functions"}},"lastModified":"2026-08-03T17:00:42.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/advanced/date-functions","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}