nuix time 을 Datetime 으로 변환하는 방법이다.

select dateadd(ss, 1482912960, '1970-01-01 09:00:00');


반대로, Datetime 을 nuix time으로 변환하는 방법이다.

select datediff(ss,'1970-01-01 09:00:00','2016-12-28 17:16:00');

Posted by 아로스

문자 체크

Windows/JAVASCRIPT 2016. 12. 21. 12:43
<html>
<script>
var chkWord = new Array( 'select', 'delete', 'update');
function chk(str)
{
for(i=0;i<chkWord.length;i++)
{
var text = str;
var findStr = chkWord[i];
if (text.indexOf(findStr) != -1) 
                        {
alert('있다');
break;
}
else 
                        {
alert('없다');
}
}
}
chk('deletesafasdfa');
</script>

<body >
</body>
</html>


Posted by 아로스

 echo date("t", time()); //월 마지막일; 

 결과: 30 


 echo date("t", mktime(0, 0, 0, 11, 23, 2016)); //월 마지막일 

 결과: 30

Posted by 아로스

특수문자 체크

Linux/PHP 2016. 11. 22. 16:41

정규식으로 특수문자를 체크한다.



$string="[aabb]";


$result = preg_match("/[ #\&\+\-%@=\/\\\:;,\.'\"\^`~\_|\!\?\*$#<>()\[\]\{\}]/i", $string);

if($result == true)

{

echo "특수문자 있음";

}

else

{

echo "특수문자 없음";

}


Posted by 아로스

추출한 데이터에서 원하는 데이터만 가져오고 싶을때 정규식을 이용해서 가져오면 간단하게 해결된다.



using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Text.RegularExpressions;


namespace ConsoleApplication1

{

    class Program

    {

        // 정규식

        const string _RegTxt = "<strong>(?<entry>.*?)</strong>";        


        static void Main(string[] args)

        {   

            //추출한 문자

            String txt = "<html><body><strong>문자</strong></body></html>";

                        

            Console.WriteLine("result : {0}", getRegText(txt, _RegTxt));                     

        }

        

        /// <summary>

        /// 문자 추출하기

        /// </summary>

        /// <param name="txt">추출한 문자</param>

        /// <param name="txtRegx">정규식</param>

        /// <returns></returns>

        public static string getRegText(string txt, string txtRegx)

        {

            Group g = null;

            string result=null; 


            Regex reg = new Regex(txtRegx, RegexOptions.IgnoreCase | RegexOptions.Singleline);

            MatchCollection resultColl = reg.Matches(txt);



            foreach (Match mm in resultColl)

            {

                g = mm.Groups[1];

                result =  mm.Groups["entry"].ToString();

            }


            return result;

        }

    }

}



Posted by 아로스

아로스

달력

05-05 05:05