# Scalars
You can use Lighthouse's built-in scalars by defining them in your schema,
using @scalar
to point them to a FQCN.
"A datetime string with format `Y-m-d H:i:s`, e.g. `2018-05-23 13:43:32`."
scalar DateTime
@scalar(class: "Nuwave\\Lighthouse\\Schema\\Types\\Scalars\\DateTime")
type Query {
"Get the local server time."
now: DateTime!
}
# Date
"A date string with format `Y-m-d`, e.g. `2011-05-23`."
scalar Date @scalar(class: "Nuwave\\Lighthouse\\Schema\\Types\\Scalars\\Date")
Internally represented as an instance of Carbon\Carbon
.
# DateTime
"A datetime string with format `Y-m-d H:i:s`, e.g. `2018-05-23 13:43:32`."
scalar DateTime
@scalar(class: "Nuwave\\Lighthouse\\Schema\\Types\\Scalars\\DateTime")
Internally represented as an instance of Carbon\Carbon
.
# Upload
"Can be used as an argument to upload files using https://github.com/jaydenseric/graphql-multipart-request-spec"
scalar Upload
@scalar(class: "Nuwave\\Lighthouse\\Schema\\Types\\Scalars\\Upload")
This Scalar can only be used as an argument, not as a return type. For more information, please refer to the file uploads guide.
The multipart form request is handled by Lighthouse, the resolver gets passed
an instance of \Illuminate\Http\UploadedFile
(opens new window)
in the argument array $variables
.