This quickstart demonstrates using the Firebase SDK for Cloud Functions with an HTTPS trigger through building an endpoint returning the current time.
The function date returns the current server date. You can pass it a format URL Query parameter to format the date.
Further reading:
Clone or download this repo and open the Dart/quickstarts/https-time-server directory.
Create a Firebase Project on the Firebase Console.
Set up your Firebase project by running firebase use --add, select your Project ID and follow the instructions.
You need to have installed the Firebase CLI. If you haven't run:
npm install -g firebase-toolsDoesn't work? You may need to change npm permissions.
First you need to get the dart dependencies of the functions:
dart pub getThis installs locally:
- The Firebase Functions Dart SDK.
- The intl pub package to format time.
Deploy to Firebase using the following command:
firebase deployThis deploys and activates the date Function.
The first time you call
firebase deployon a new project with Functions will take longer than usual.
Alteratively, you can call firebase emulators:start to test the functions on the local emulator suite.
After deploying the function, check the CLI's output to see the URL for your function.
It will look something like: https://<function-name>-<random-hash>.<region>.run.app
You can also send the format in the request body. For instance using cURL in the command line:
curl -H 'Content-Type: application/json' /
-d '{"format": "MMMM d yyyy, h:mm:ss a"}' /
<function url>Formatted dates should be displayed.
We are responding with a 403 error in case of PUT requests:
curl -X PUT -d '{"format": "MMMM d yyyy, h:mm:ss a"}' <function-url>We'd love that you contribute to the project. Before doing so please read our Contributor guide.
© Google, 2026. Licensed under an Apache-2 license.