( ! ) Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKBase.class.php on line 114
Call Stack
#TimeMemoryFunctionLocation
10.0003414184{main}( ).../index.php:0
20.15254273632Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.671413052984Joomla\CMS\Application\SiteApplication->render( ).../CMSApplication.php:202
40.671613052928Joomla\CMS\Application\SiteApplication->render( ).../SiteApplication.php:778
50.671613053304Joomla\CMS\Document\HtmlDocument->parse( ).../CMSApplication.php:1030
60.671613053304Joomla\CMS\Document\HtmlDocument->_fetchTemplate( ).../HtmlDocument.php:545
70.671813053400Joomla\CMS\Document\HtmlDocument->_loadTemplate( ).../HtmlDocument.php:730
80.672213091032require( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/component.php' ).../HtmlDocument.php:668
90.677813381712GKTemplate->__construct( ).../component.php:31
100.688813523232GKTemplateMenu->getMenuType( ).../gk.framework.php:84
110.689813567496require_once( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKMenu.php' ).../helper.menu.php:19

( ! ) Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKHandheld.php on line 76
Call Stack
#TimeMemoryFunctionLocation
10.0003414184{main}( ).../index.php:0
20.15254273632Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.671413052984Joomla\CMS\Application\SiteApplication->render( ).../CMSApplication.php:202
40.671613052928Joomla\CMS\Application\SiteApplication->render( ).../SiteApplication.php:778
50.671613053304Joomla\CMS\Document\HtmlDocument->parse( ).../CMSApplication.php:1030
60.671613053304Joomla\CMS\Document\HtmlDocument->_fetchTemplate( ).../HtmlDocument.php:545
70.671813053400Joomla\CMS\Document\HtmlDocument->_loadTemplate( ).../HtmlDocument.php:730
80.672213091032require( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/component.php' ).../HtmlDocument.php:668
90.677813381712GKTemplate->__construct( ).../component.php:31
100.692113690240GKTemplateMenu->getMenuType( ).../gk.framework.php:85
在不同日期格式下批处理输出自定义格式的日期和时间
Logo
Print this page

在不同日期格式下批处理输出自定义格式的日期和时间

在Windows系统中有不同的语言版本和时区设置。有时,由于业务的需求,我们需要生成“年月日”格式的日期格式目录,然后在该目录中生成时间格式的文件,用来记录系统当前时间的日志信息。

系统日期有yy-mm-dd,mm-dd-yy以及dd-mm-yy三种格式,这样导致了使用的不方便。下面介绍几种实现方法:

  1. 有 人通过预先修改windows注册表将日期改成yy-mm-dd格式然后通过发出命令:c:\> echo %date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%这种该注册表的方法显然不是很可取。
  2. 还有人通过vbs来实现,制作成批处理文件内容如下:@echo off
    echo wscript.echo year(date) ^& right(”0″ ^& month(date),2) ^& right(”0″ ^& day(date),2) ^& right(”0″ ^& hour(time),2) ^& right(”0″ ^& minute(time),2)>%tmp%\temp1.vbs
    cscript /nologo %tmp%\temp1.vbs
    del %tmp%\temp1.vbs 

    这种使用script的方式也不是很好。

  3. 我认为最好的方式是,通过批处理中的for语句进行系统日期格式的判断,然后进行处理。批处理文件内容如下:

@ECHO OFF

ECHO. |DATE > temp1
FOR /F “eol=T tokens=5 delims=() ” %%i in (temp1) do set date_format=%%i
FOR /F “eol=E tokens=5,6,7,8 delims=/- ” %%a in (temp1) do (
    IF /I %date_format% EQU mm-dd-yy ( set month=%%a
                                       set day=%%b
                                       set year=%%c
                                       set week=%%d )
    IF /I %date_format% EQU dd-mm-yy ( set day=%%a
                                       set month=%%b
                                       set year=%%c
                                       set week=%%d )
    IF /I %date_format% EQU yy-mm-dd ( set year=%%a
                                       set month=%%b
                                       set day=%%c
                                       set week=%%d )      )

ECHO. |TIME > temp2
FOR /F “eol=E tokens=5-8 delims=:. ” %%A in (temp2) do ( set hour=%%A
                                                         set minute=%%B
                                                         set second=%%C
                                                         set hundredth=%%D )
                                                        
REM TIME format 08:10:00 PM, it means 20:10:00
REM IF %meridiem% EQU PM SET /A %%hour%%=%%hour%%+12

SET current_date=%year%%month%%day%
SET current_time=%hour%%minute%%second%%hundredth%

IF EXIST temp1 DEL /Q temp1
IF EXIST temp2 DEL /Q temp2

ECHO Current date = %current_date%
ECHO Current time = %current_time%

MKDIR %current_date%
ECHO. > %current_date%\%current_time%.log

Last modified onSunday, 14 October 2012 04:07

( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169
Call Stack
#TimeMemoryFunctionLocation
10.0001405704{main}( ).../index.php:0
20.07641324592Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.07641324592Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.21352983296Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.21483008360Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.21593063688Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.21603080744require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.22513224832K2ControllerItem->execute( ).../k2.php:64
90.22513224832K2ControllerItem->display( ).../BaseController.php:710
100.23153493912K2ControllerItem->display( ).../item.php:78
110.23153493912K2ControllerItem->display( ).../controller.php:19
120.23303512432Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.23993532848K2ViewItem->display( ).../ViewController.php:102
140.29884077664K2ViewItem->display( ).../view.html.php:742
150.29884077664K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.30034252384include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701

( ! ) Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478
Call Stack
#TimeMemoryFunctionLocation
10.0001405704{main}( ).../index.php:0
20.07641324592Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.07641324592Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.21352983296Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.21483008360Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.21593063688Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.21603080744require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.22513224832K2ControllerItem->execute( ).../k2.php:64
90.22513224832K2ControllerItem->display( ).../BaseController.php:710
100.23153493912K2ControllerItem->display( ).../item.php:78
110.23153493912K2ControllerItem->display( ).../controller.php:19
120.23303512432Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.23993532848K2ViewItem->display( ).../ViewController.php:102
140.29884077664K2ViewItem->display( ).../view.html.php:742
150.29884077664K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.30034252384include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701
Template Design © Joomla Templates | GavickPro. All rights reserved.