English 中文(简体)
如何使用两种形式?
原标题:How to use two date types in form?
  • 时间:2012-04-27 08:29:56
  •  标签:
  • php

基本上,Im现在从事接触形式,我需要增加两个日期。 用户可以说明其将使用什么日期,然后在说明中使用(美国或欧洲)确切的日期。 这是容易的,如果发言,我可以这样做,但下一个发言是数据库的节省日期。 基本上,我的数据库表是时间的,节省欧洲时间是容易的,但美国时间如何? 基本上,我以中美洲时间的形式,有一小时(一至十二分)、一分钟(1至60分)和一段时期(AM和PM),基本上有3项选择投入,因此,任何想法,我如何将其转换为24小时,然后作为欧洲日期节省数据库?

在欧洲时代已经做了一切,现在只有美国时间离开。

希望你们理解我所说的话。

最佳回答

使用<条码> 它可在任何日期和时间之间转换;你希望采用的时间格式

$date = DateTime::createFromFormat("m/d/Y","03/32/2012");
echo $date->format("d-m-Y"); // You can use any format 

页: 1

echo $date->format("U"); // Timestamp 

如果你只想利用职能,

$date = date_create_from_format("m/d/Y","03/32/2012");
echo date_format($date, "d-m-Y");

For documentation on different formats : http://www.php.net/manual/en/datetime.createfromformat.php

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签