PHP code example of nswdpc / silverstripe-datetime-inputs
1. Go to this page and download the library: Download nswdpc/silverstripe-datetime-inputs 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/ */
nswdpc / silverstripe-datetime-inputs example snippets
$dateValue = "2028-01-30";
// Date only
$field = DateCompositeField::create(
'EventDate',
_t(
'app.EVENT_DATE',
'Date of the event'
),
$dateValue
)->setDescription(
_t(
'app.EVENT_DATE_TIME_DESCRIPTION',
'Provide the date of the event'
)
);
// Date and Time
$datetimeValue = "2028-01-30 11:45";
$field = DatetimeCompositeField::create(
'EventDateTime',
_t(
'app.EVENT_DATE_TIME',
'Date and time of the event'
),
$datetimeValue
)->setDescription(
_t(
'app.EVENT_DATE_TIME_DESCRIPTION',
'Provide the date and time of the event'
)
);