blob: 071eb80695e0a3f26fdf141592b0c4973c5e2be4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<?php
namespace JsonApi\Routes;
trait TimestampTrait
{
protected static function fromISO8601($strISO8601Timestamp)
{
if ($atom = date_create_from_format(\DATE_ATOM, $strISO8601Timestamp)) {
return $atom;
}
return date_create_from_format('Y-m-d\TH:i:s.uP', $strISO8601Timestamp);
}
protected static function isValidTimestamp($strISO8601Timestamp)
{
return false !== self::fromISO8601($strISO8601Timestamp);
}
}
|