[ASP] 날짜형식 변환 (dateFormat) | Server Side

하여간 ASP는 여러가지로 귀찮게 함..;;

 

Function get_DateTimeFormat(obj_date, dateFormat)
  Dim reValue
  
  if false = IsDate(obj_date) then
   obj_date = now
  end if
  
  if dateFormat = "" then
   dateFormat = "yyyy-mm-dd-h:n:s"
  end if
 
  reValue = Replace(dateFormat, "yyyy", Year(obj_date))
  reValue = Replace(reValue, "mm", right("0" & Month(obj_date) , 2))
  reValue = Replace(reValue, "dd", right("0" & Day(obj_date) , 2))
  reValue = Replace(reValue, "h", right("0" & Hour(obj_date) , 2))
  reValue = Replace(reValue, "n", right("0" & Minute(obj_date) , 2))
  reValue = Replace(reValue, "s", right("0" & Second(obj_date) , 2))
 
  get_DateTimeFormat = reValue
 End Function

 

dateFormat
Comment Write
Comment List
등록된 코멘트가 없습니다.