PHP code example of digiaonline / graphql-datetime-scalar

1. Go to this page and download the library: Download digiaonline/graphql-datetime-scalar library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

digiaonline / graphql-datetime-scalar example snippets


$executableSchema = buildSchema($schemaDefinition, [
    'Query'    => QueryResolver::class,
    'Mutation' => MutationResolver::class,
], [
    'types' => [
        new DateScalarType(),
        new TimeScalarType(),
        new DateTimeScalarType(),
    ],
]);

$dateType     = new DateScalarType('j.n.Y'); // 31.12.2018
$timeType     = new TimeScalarType('H:i'); // 14:35
$dateTimeType = new DateTimeScalarType('U'); // 1537361927