Time functions In ASP format

Source: Internet
Author: User

<% Response. expires = 0%>
<%
Function formatdate (SSTR, sformat, schar)
If SSTR = "" or not isdate (SSTR) or schar = "" then
'Response. Write "null"
Formatdate = ""
Exit Function
End if

Dim syear, smonth, SDAY, Shour, sminute, sSecond
Syear = year (SSTR)
If Len (syear) <4 then syear = "20" & syear
Smonth = month (SSTR)
If clng (smonth) <10 and Len (smonth) <2 then smonth = "0" & smonth
SDAY = Day (SSTR)
If clng (SDAY) <10 and Len (SDAY) <2 then SDAY = "0" & SDAY
Shour = hour (SSTR)
If clng (Shour) <10 and Len (Shour) <2 then Shour = "0" & Shour
Sminute = minute (SSTR)
If clng (sminute) <10 and Len (sminute) <2 then sminute = "0" & sminute
SSecond = second (SSTR)
If clng (sSecond) <10 and Len (sSecond) <2 then sSecond = "0" & sSecond

Select case ucase (sformat)
Case "yyyymm"
Formatdate = syear & schar & smonth
Case "yyyymmdd"
Formatdate = syear & schar & smonth & schar & SDAY
Case "yyyymm @"
Formatdate = syear & "äê" & smonth & "ô â"
Case "yyyymmdd @"
Formatdate = syear & "äê" & smonth & "ô â" & SDAY & "è õ"
Case "yyyymmddhhmmss_null"

Formatdate = syear & smonth & SDAY & Shour & sminute & sSecond
Case "yyyymmddhhmmss"
Formatdate = syear & schar & smonth & schar & SDAY & "" & Shour & ":" & sminute
Case "yyyymmddhhmm"
Formatdate = syear & schar & smonth & schar & SDAY & "" & Shour & ":" & sminute
Case "yyyymmddhhmmss @"
Formatdate = syear & "äê" & smonth & "ô â" & SDAY & "è õ" & Shour & "ê ±" & sminute & "· ö" & sSecond &" zookeeper"

Case else
Formatdate = SSTR
End select
End Function

Function gettextarea (SSTR)
If SSTR = "" then
SSTR = ""
Else
SSTR = Replace (replace (SSTR, CHR (10), "<br>"), CHR (32), "& nbsp ;")
End if
Gettextarea = SSTR
End Function

Function gettextareatodb (SSTR)
If SSTR = "" then
SSTR = ""
Else
SSTR = Replace (replace (SSTR, CHR (10), "<br>"), CHR (32), "& nbsp ;")

End if
Gettextareatodb = SSTR
End Function

Function detextarea (SSTR)
If SSTR = "" then
SSTR = ""
Else
SSTR = Replace (replace (SSTR, "<br>", CHR (10), "& nbsp;", CHR (32 ))
End if
Detextarea = SSTR
End Function

Function pub_getmemovalue (SSTR)
Dim s_str
S_str = SSTR
If s_str = "" Or isnull (s_str) then
Pub_getmemovalue = "& nbsp ;"
Else
Pub_getmemovalue = rtrim (s_str)
End if
End Function

function pub_getmemovalue_sub (SSTR, slen)
dim s_str
s_str = SSTR
If s_str = "" Or isnull (s_str) then
pub_getmemovalue_sub = "& nbsp;"
else
If Len (s_str)> slen then
pub_getmemovalue_sub = rtrim (mid (s_str, 1, slen ))&"... "
else
pub_getmemovalue_sub = rtrim (s_str)
end if
end function
%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.