summaryrefslogtreecommitdiffstats
path: root/system/helpers/date_helper.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2023-01-29 13:58:21 +0100
committerFlorian Pritz <bluewind@xinu.at>2023-01-29 13:58:21 +0100
commitc88be04f0ec35304be812d7f5379c4362008b730 (patch)
tree0d161faf7b5d03396fcab28e1ecb8e8764f32cb2 /system/helpers/date_helper.php
parent457e351cbc1335de951f4ac79bb91a9f3ea9ab38 (diff)
parenta6faab2ebf082eefff9c2422fce016e49da548bf (diff)
Merge remote-tracking branch 'upstream/develop' into dev
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'system/helpers/date_helper.php')
-rw-r--r--system/helpers/date_helper.php106
1 files changed, 0 insertions, 106 deletions
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index 5b2f3e099..6ea9d82bd 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -123,46 +123,6 @@ if ( ! function_exists('mdate'))
// ------------------------------------------------------------------------
-if ( ! function_exists('standard_date'))
-{
- /**
- * Standard Date
- *
- * Returns a date formatted according to the submitted standard.
- *
- * As of PHP 5.2, the DateTime extension provides constants that
- * serve for the exact same purpose and are used with date().
- *
- * @todo Remove in version 3.1+.
- * @deprecated 3.0.0 Use PHP's native date() instead.
- * @link https://www.php.net/manual/en/class.datetime.php#datetime.constants.types
- *
- * @example date(DATE_RFC822, now()); // default
- * @example date(DATE_W3C, $time); // a different format and time
- *
- * @param string $fmt = 'DATE_RFC822' the chosen format
- * @param int $time = NULL Unix timestamp
- * @return string
- */
- function standard_date($fmt = 'DATE_RFC822', $time = NULL)
- {
- if (empty($time))
- {
- $time = now();
- }
-
- // Procedural style pre-defined constants from the DateTime extension
- if (strpos($fmt, 'DATE_') !== 0 OR defined($fmt) === FALSE)
- {
- return FALSE;
- }
-
- return date(constant($fmt), $time);
- }
-}
-
-// ------------------------------------------------------------------------
-
if ( ! function_exists('timespan'))
{
/**
@@ -491,72 +451,6 @@ if ( ! function_exists('human_to_unix'))
// ------------------------------------------------------------------------
-if ( ! function_exists('nice_date'))
-{
- /**
- * Turns many "reasonably-date-like" strings into something
- * that is actually useful. This only works for dates after unix epoch.
- *
- * @deprecated 3.1.3 Use DateTime::createFromFormat($input_format, $input)->format($output_format);
- * @param string The terribly formatted date-like string
- * @param string Date format to return (same as php date function)
- * @return string
- */
- function nice_date($bad_date = '', $format = FALSE)
- {
- if (empty($bad_date))
- {
- return 'Unknown';
- }
- elseif (empty($format))
- {
- $format = 'U';
- }
-
- // Date like: YYYYMM
- if (preg_match('/^\d{6}$/i', $bad_date))
- {
- if (in_array(substr($bad_date, 0, 2), array('19', '20')))
- {
- $year = substr($bad_date, 0, 4);
- $month = substr($bad_date, 4, 2);
- }
- else
- {
- $month = substr($bad_date, 0, 2);
- $year = substr($bad_date, 2, 4);
- }
-
- return date($format, strtotime($year.'-'.$month.'-01'));
- }
-
- // Date Like: YYYYMMDD
- if (preg_match('/^\d{8}$/i', $bad_date, $matches))
- {
- return DateTime::createFromFormat('Ymd', $bad_date)->format($format);
- }
-
- // Date Like: MM-DD-YYYY __or__ M-D-YYYY (or anything in between)
- if (preg_match('/^(\d{1,2})-(\d{1,2})-(\d{4})$/i', $bad_date, $matches))
- {
- return date($format, strtotime($matches[3].'-'.$matches[1].'-'.$matches[2]));
- }
-
- // Any other kind of string, when converted into UNIX time,
- // produces "0 seconds after epoc..." is probably bad...
- // return "Invalid Date".
- if (date('U', strtotime($bad_date)) === '0')
- {
- return 'Invalid Date';
- }
-
- // It's probably a valid-ish date format already
- return date($format, strtotime($bad_date));
- }
-}
-
-// ------------------------------------------------------------------------
-
if ( ! function_exists('timezone_menu'))
{
/**