반응형
반응형
반응형

// 날짜및 시간 구하기 1(localtime)

#include <stdio.h>
#include <time.h>

 

void main(void)
{
 time_t now;
 struct tm t;

 time(&now);

 t = *localtime(&now);

 printf("현재 날짜 및 시간:%4d.%d.%d %d:%d:%d\n", t.tm_year+1900, t.tm_mon+1, t.tm_mday
  ,t.tm_hour,t.tm_min, t.tm_sec);
}

// 날짜 및 시간 구하기 2(_ftime)

#include <stdio.h>
#include <time.h>
#include <sys/timeb.h>

 

void main(void)
{
 struct _timeb tb;
 struct tm t;

 _ftime(&tb);

 t=*localtime(&tb.time);

 printf("현재 날짜 및 시간 : %4d.%d.%d %d:%d:%d.%d \n"
  , t.tm_year+1900, t.tm_mon+1, t.tm_mday
  , t.tm_hour, t.tm_min, t.tm_sec, tb.millitm);
}

 

반응형

'프로그래밍 > C 언어' 카테고리의 다른 글

c++ 에서 new, delete 메모리 할당 해제 관련글  (0) 2009.05.07
memset 사용법 - 주의사항  (1) 2009.02.11
debuging 하기. (아파치에서)  (0) 2009.02.11
c언어 함수 요약  (0) 2009.02.11
반응형
@header("Expires: 0");
@header("Cache-Control: no-cache, must-revalidate");
@header("Pragma: no-cache");
header("Content-type: text/html; charset=euc-kr");
반응형

'프로그래밍 > PHP' 카테고리의 다른 글

파일 업로드.  (0) 2012.07.11
[Oracle] BLOB insert 하기  (0) 2009.02.11
한글 자르기  (0) 2009.02.11
페이지 구하기  (0) 2009.02.11
파일 크기 구하기(단위별)  (0) 2009.02.11
반응형

// 한글 길이 자르기.
function han_substr($string, $limit_length)
{
    $string_length = strlen( $string );
    if( $limit_length > $string_length ) return $string;
    else
    {
        $string = substr( $string, 0, $limit_length );
        $han_char = 0;
        for($i = $limit_length - 1; $i >= 0; $i--)
        {
            $lastword = ord(substr($string, $i, 1)); //뒤에서 한글자씩 떼어서
            if(127 > $lastword) break; //정상적인 영문자,숫자라면..stop
            else $han_char++; //한글 or 특수문자라면..
        }
 
        //짝이 안맞으므로 한글자 더 작게 자른다.
        if($han_char%2 == 1) $string = substr( $string, 0, $limit_length-1 );
        return ($string."...");
    }
}
반응형

'프로그래밍 > PHP' 카테고리의 다른 글

[Oracle] BLOB insert 하기  (0) 2009.02.11
한글 사용할때 헤더  (0) 2009.02.11
페이지 구하기  (0) 2009.02.11
파일 크기 구하기(단위별)  (0) 2009.02.11
form 에서 method get 안될때..  (0) 2009.02.11
반응형
<style>
.pageNumStyleTB TD {padding-bottom:3px;}
.pageNumStyle_Sel , .pageNumStyle_Out , .pageNumStyle_Over {width:30px; font:bold 9pt Verdana; text-align:center;}
.pageNumStyle_Sel {color:#CC6600;}
.pageNumStyle_Out {cursor:pointer; background-color:#FFFFFF; color:#0A87D1;}
.pageNumStyle_Over {cursor:pointer; background-color:#F5F2E7; color:#0A87D1; text-decoration:underline;}
.pageInfo1 {text-align:left; background-color:#f2f2f2; font-size:12px; padding:5 5 5 40px}
</style>




// 현재 페이지.
        if(!$c_page) $c_page = 1;
 
        // 한번에 20개의 list 출력.
        $view_list = 20;
        $total_row = 총 row 의 수.
        $start_limit = ($c_page - 1) * $view_list;
        $limit_qry = "LIMIT $start_limit, $view_list";

<table border="0" cellpadding="0" cellspacing="0" class="pageNumStyleTB" align="center" style="margin:20px 2px 3px 2px;">
<tr>

<?
    // 총 페이지 번호 수 - 올림함수.
    $total_page = ceil($total_row / $view_list);
 
    // c_page, view_list(한페이지에 20개씩)
    // 한번에 5개의 페이지번호  출력.
    $view_page = 5;
 
    // 출력할 시작 페이지번호  ~ 끝 페이지번호 .
    $print_start_page = (ceil($c_page / $view_page) -1) * $view_page + 1;
    $print_end_page = ceil($c_page / $view_page) * $view_page;
    if($print_end_page > $total_page) $print_end_page = $total_page;
 
    // 페이지 링클 걸때 필요한 form 파라미터.
    $link_parameter = "search_mode=$search_mode&search_word=$search_word&id=$id";
 
    // 이전 5페이지 - 화살표.
    if($print_start_page > 1)
    {
        $pre_end_page = $print_start_page - 1;
        echo "<td width=\"20\" align=\"center\" style=\"font:8pt 돋움;padding-top:2px;color:#999999;\"><a href='$PHP_SELF?c_page=$pre_end_page&$link_parameter'>◀</a></td>";
    }
// 5페이지 출력.
    for($i = $print_start_page; $i <= $print_end_page; $i++)
    {
        if($i == $c_page) echo "<td class=\"pageNumStyle_Sel\">$i</td>";
        else echo "<td =\"location.href='$PHP_SELF?c_page=$i&$link_parameter'\" =\"this.className = 'pageNumStyle_Over'\" =\"this.className = 'pageNumStyle_Out'\" class=\"pageNumStyle_Out\">$i</td>";
 
        if($i != $print_end_page) echo "<td width=\"1\"><img src=\"http://icons.com.ne.kr/trandot.gif\" height=\"15\" width=\"1\" style=\"background-color:#CCCCCC;\"></td>";
    }
 
    // 이후 5페이지 - 화살표.
    if($total_page > $print_end_page) echo "<td width=\"20\" align=\"center\" style=\"font:8pt 돋움;padding-top:2px;color:#999999;\"><a href='$PHP_SELF?c_page=$i&$link_parameter'>▶</a></td>";

?>
</tr>
</table>

반응형

'프로그래밍 > PHP' 카테고리의 다른 글

한글 사용할때 헤더  (0) 2009.02.11
한글 자르기  (0) 2009.02.11
파일 크기 구하기(단위별)  (0) 2009.02.11
form 에서 method get 안될때..  (0) 2009.02.11
require 와 include 의 차이점  (0) 2009.02.06
반응형
// 파일 사이즈 구하는 함수.
function human_file_size($size)
{
    if($size == 0) return("0 MB");
    $filesizename = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
    return round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $filesizename[$i];
}
반응형

'프로그래밍 > PHP' 카테고리의 다른 글

한글 자르기  (0) 2009.02.11
페이지 구하기  (0) 2009.02.11
form 에서 method get 안될때..  (0) 2009.02.11
require 와 include 의 차이점  (0) 2009.02.06
정규표현식  (0) 2009.02.06

+ Recent posts