error_reporting(E_ALL);
ini_set("display_errors", 1);
php 상단에 위와 같이 선언
오류 출력 해줌
blog.visualp.com
error_reporting(E_ALL);
ini_set("display_errors", 1);
php 상단에 위와 같이 선언
오류 출력 해줌
Note that the order of parameters in SQL Server and MySQL CONVERT functions is different.
SQL Server:
-- 3rd parameter specifies 121 style (ODBC 'YYYY-MM-DD HH:MI:SS.FFF' format with milliseconds) SELECT CONVERT(DATETIME, '2012-11-29 18:21:11.123', 121); # 2012-11-29 18:21:11.123 SELECT CONVERT(DATETIME, GETDATE()); # 2017-04-07 09:55:40.550
MySQL:
-- Specify string format using format specifiers SELECT STR_TO_DATE('2012-11-29 18:21:11.123', '%Y-%m-%d %T.%f'); # 2012-11-29 18:21:11.123000 SELECT CONVERT(NOW(), DATETIME); # 2017-04-07 09:55:40
When you convert CONVERT function to STR_TO_DATE you have to map the SQL Server style to the appropriate format string in MySQL:
SQL Server Style | MySQL Format String | String Example | |
101 | US - MM/DD/YYYY | '%m/%d/%Y' | '11/29/2012' |
121 | ODBC - YYYY-MM-DD HH:MI:SS.FFF | '%Y-%m-%d %T.%f' | '2012-11-29 18:21:11.123' |
Conversion examples:
SQL Server | MySQL |
CONVERT(DATETIME, '11/29/2012', 101) | STR_TO_DATE('11/29/2012', '%m/%d/%Y') |
CONVERT(DATETIME, '2012-11-29 18:21:11.123', 121) | STR_TO_DATE('2012-11-29 18:21:11.123', '%Y-%m-%d %T.%f') |
In SQL Server SMALLDATETIME data type stores a datetime value with 00 seconds. You can use the expression below to keep 00 seconds after using the CONVERT function in MySQL:
SQL Server:
-- SMALLDATETIME is always with 00 seconds SELECT CONVERT(SMALLDATETIME, GETDATE()); # 2017-04-07 10:05:00
MySQL:
SELECT CONVERT(DATE_FORMAT(NOW(), '%Y-%m-%d %H-%i-00'), DATETIME); # 2017-04-07 10:05:00
1 |
if ( $row [ 'io_price' ] >= 0) |
2 |
$price = ' + ' .number_format( $row [ 'io_price' ]). '원' ; |
3 |
else |
4 |
$price = ' ' .number_format( $row [ 'io_price' ]). '원' ; |
1 |
if ( $row [ 'io_price' ] > 0) |
2 |
$price = ' + ' .number_format( $row [ 'io_price' ]). '원' ; |
3 |
else if ( $row [ 'io_price' ] == 0) |
4 |
$price = '' ; |
5 |
else |
6 |
$price = ' ' .number_format( $row [ 'io_price' ]). '원' ; |
1 |
if ( $row [ 'io_price' ] >= 0) |
2 |
$price = ' + ' .number_format( $row [ 'io_price' ]). '원' ; |
3 |
else |
4 |
$price = ' ' .number_format( $row [ 'io_price' ]). '원' ; |
1 |
if ( $row [ 'io_price' ] > 0) |
2 |
$price = ' + ' .number_format( $row [ 'io_price' ]). '원' ; |
3 |
else if ( $row [ 'io_price' ] == 0) |
4 |
$price = '' ; |
5 |
else |
6 |
$price = ' ' .number_format( $row [ 'io_price' ]). '원' ; |
1 |
var priceHide = '' ; |
2 |
if (parseInt(price) == 0) priceHide = ' sound_only' ; |
1 |
opt += "<span class=\"sit_opt_prc\">" +opt_prc+ "</span>" ; |
1 |
opt += "<span class=\"sit_opt_prc" +priceHide+ "\">" +opt_prc+ "</span>" ; |
그누모드 이용해서 사이트 구축 하다보면 icodekorea.com과 sms 서비스 연동을
하는 모듈을 사용하게 되면, 에러가 발생한다.
에러인즉 fsockopen 함수를 사용하여 주고 받게 되는대
동작을 하지 않는다는거 ..
서버에서 정상적으로 라우팅을 못하는 문제 임으로
./etc/network 에 다음과 같이 추가 해준다.
211.172.232.124 wwww.icodekorea.com
network 재시작
하면 해결됨
[원문 ] : http://bloodguy.tistory.com/entry/PHP-%EB%82%A0%EC%A7%9C-%EC%9D%BC%EC%88%98-%EC%B0%A8%EC%9D%B4-%EA%B3%84%EC%82%B0-datediff-DateTimeDateInterval
정확한 날짜 일수를 계산하기 위한 간편한 방법.
여러가지 방법들이 산더미 같이 있겠지만 다 귀찮고 DateTime, DateInterval 객체를 이용하는 가장 간단한 방법.
<?PHP /*5.3 이상에서*/
$시작일 = new DateTime('2012-01-01'); // 20120101 같은 포맷도 잘됨
$종료일 = new DateTime('2012-10-11');
// $차이 는 DateInterval 객체. var_dump() 찍어보면 대충 감이 옴.
$차이 = date_diff($시작일, $종료일);
echo $차이->days; // 284
?>
/*php 5.2 버전 에서*/
<?php
$start = new DateTime('2010-10-12');
$end = new DateTime('2010-10-15');
$days = round(($end->format('U') - $start->format('U')) / (60*60*24));
echo $days;
?>
[참조]
http://www.php.net/manual/en/datetime.diff.php
http://www.php.net/manual/en/class.dateinterval.php
http://www.php.net/manual/en/class.datetime.php