BVB Source Codes

The latest thinkphp v5.2 work order system Show modifier.date_format.php Source code

Return Download The latest thinkphp v5.2 work order system: download modifier.date_format.php Source code - Download The latest thinkphp v5.2 work order system Source code - Type:.php
  1. <?php
  2. /**
  3.  * Smarty plugin
  4.  *
  5.  * @package Smarty
  6.  * @subpackage PluginsModifier
  7.  */
  8.  
  9. /**
  10.  * Smarty date_format modifier plugin
  11.  *
  12.  * Type:     modifier<br>
  13.  * Name:     date_format<br>
  14.  * Purpose:  format datestamps via strftime<br>
  15.  * Input:<br>
  16.  *          - string: input date string
  17.  *          - format: strftime format for output
  18.  *          - default_date: default date if $string is empty
  19.  *
  20.  * @link http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
  21.  * @author Monte Ohrt <monte at ohrt dot com>
  22.  * @param string $string       input date string
  23.  * @param string $format       strftime format for output
  24.  * @param string $default_date default date if $string is empty
  25.  * @param string $formatter    either 'strftime' or 'auto'
  26.  * @return string |void
  27.  * @uses smarty_make_timestamp()
  28.  */
  29. function smarty_modifier_date_format($string, $format = SMARTY_RESOURCE_DATE_FORMAT, $default_date = '',$formatter='auto')
  30. {
  31.     /**
  32.     * Include the {@link shared.make_timestamp.php} plugin
  33.     */
  34.     require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
  35.     if ($string != '') {
  36.         $timestamp = smarty_make_timestamp($string);
  37.     } elseif ($default_date != '') {
  38.         $timestamp = smarty_make_timestamp($default_date);
  39.     } else {
  40.         return;
  41.     }
  42.     if($formatter=='strftime'||($formatter=='auto'&&strpos($format,'%')!==false)) {
  43.         if (DS == '\\') {
  44.             $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');
  45.             $_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');
  46.             if (strpos($format, '%e') !== false) {
  47.                 $_win_from[] = '%e';
  48.                 $_win_to[] = sprintf('%\' 2d', date('j', $timestamp));
  49.             }
  50.             if (strpos($format, '%l') !== false) {
  51.                 $_win_from[] = '%l';
  52.                 $_win_to[] = sprintf('%\' 2d', date('h', $timestamp));
  53.             }
  54.             $format = str_replace($_win_from, $_win_to, $format);
  55.         }
  56.         return strftime($format, $timestamp);
  57.     } else {
  58.         return date($format, $timestamp);
  59.     }
  60. }
  61.  
  62. ?>
downloadmodifier.date_format.php Source code - Download The latest thinkphp v5.2 work order system Source code
Related Source Codes/Software:
V3.3.6 Workerman high-performance PHP Socket (framework) - High performance PHP Socket framework Workerman re... 2017-05-03
The phosphor meeting room reservation system MRBS (loop reservation v16.0) - The phosphor meeting room reservation system MRBS ... 2017-05-03
IDC v5.2.3 agent center - IDC Centre IDC for exploitation is a PHP+MySQL age... 2017-05-03
Zen master v9.0.1 project management software - Zen is the first domestic open source project mana... 2017-05-03
Ray speed v7.03 employee files management system - Employee files project is various, and some conten... 2017-05-03
HITCMS Haitian responsive electronic mechanical v3.0 foreign trade website source code - HITCMS Haitian response electronic machinery trade... 2017-05-03
Ray v7.02 speed survey system - Lightning speed survey system is a. NET+MSSQL deve... 2017-05-03
Cool HITCMS reactive black v3.0 enterprise website source code - HITCMS-Haitian response black enterprises website ... 2017-05-03
WebOA v17.2 network office automation system - WebOA network using b/s structure development of o... 2017-05-03
Pure imitation of han site source code, one a 】 【 c9cms kernel v1.0 - Generic http://www.wufazhuce.com/Han one · Config... 2017-05-04
zone.js - Implements Zones for JavaScript ... 2017-05-11
dragonfly - A Ruby gem for on-the-fly processing - suitable fo... 2017-05-11
oh-my-fish - The Fishshell Framework. 2017-05-11
canvas-lms - The open LMS by Instructure, Inc. 2017-05-11
ledger - Double-entry accounting system with a command-line... 2017-05-11
Python - My Python Examples http://w... 2017-05-11
blade - 2017-05-11
LaZagne - Credentials recovery project 2017-05-10
Pull-to-Refresh.Rentals-iOS - This project aims to provide a simple and customiz... 2017-05-10
spoon - Distributing instrumentation tests to all your And... 2017-05-10

 Back to top