微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

同时输入php时间减法时得到错误的值

如何解决同时输入php时间减法时得到错误的值

$startTime= '07:00:00';
$EndTime = '07:24:13';
$sst = strtotime($startTime);
$eet=  strtotime($EndTime);
$diff= $eet-$sst;
echo $timeElapsed= gmdate("h:i:s",$diff);

这里的答案必须是24分13秒,但我得到的结果是12:24:13。

解决方法

尝试一下:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">

    <persistence-unit name="NewPersistenceUnit">
        <class>com.beetlehand.model.AttributeEntity</class>
        <class>com.beetlehand.model.AttributeValueEntity</class>
        <class>com.beetlehand.model.AuditEntity</class>
        <class>com.beetlehand.model.CategoryEntity</class>
        <class>com.beetlehand.model.CustomerEntity</class>
        <class>com.beetlehand.model.DepartmentEntity</class>
        <class>com.beetlehand.model.OrderDetailEntity</class>
        <class>com.beetlehand.model.OrdersEntity</class>
        <class>com.beetlehand.model.ProductEntity</class>
        <class>com.beetlehand.model.ProductAttributeEntity</class>
        <class>com.beetlehand.model.ProductCategoryEntity</class>
        <class>com.beetlehand.model.ReviewEntity</class>
        <class>com.beetlehand.model.ShippingEntity</class>
        <class>com.beetlehand.model.ShippingRegionEntity</class>
        <class>com.beetlehand.model.ShoppingCartEntity</class>
        <class>com.beetlehand.model.TaxEntity</class>
        <properties>
            <property name="toplink.jdbc.url" value="jdbc:mysql://localhost:3306/beetlehand"/>
            <property name="toplink.jdbc.driver" value="com.mysql.jdbc.Driver"/>
            <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/beetlehand"/>
            <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
            <property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/beetlehand"/>
            <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver"/>
            <property name="eclipselink.jdbc.url" value="jdbc:mysql://localhost:3306/beetlehand"/>
            <property name="eclipselink.jdbc.driver" value="com.mysql.jdbc.Driver"/>

            <property name="hibernate.connection.username" value="username"/>
            <property name="hibernate.connection.password" value="password"/>

        </properties>
    </persistence-unit>
</persistence>

您的代码中有一个错字,H必须是大写。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。