| 64 |
jtweddle |
1 |
<%
|
|
|
2 |
'=============================================================
|
|
|
3 |
'//
|
|
|
4 |
'// Formater
|
|
|
5 |
'//
|
|
|
6 |
'// version: 0.2
|
|
|
7 |
'// last modified: 15-Sep-2004 13:38 by Sasha Vukovic
|
|
|
8 |
'=============================================================
|
|
|
9 |
%>
|
|
|
10 |
<%
|
|
|
11 |
Class Formater
|
|
|
12 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
13 |
Public Function FormatDate ( sDate, nType )
|
|
|
14 |
Dim mDay, mMonth, mYear
|
|
|
15 |
|
|
|
16 |
If (sDate = "") OR IsNull(sDate) Then Exit Function
|
|
|
17 |
|
|
|
18 |
Call SplitDate ( sDate, mDay, mMonth, mYear )
|
|
|
19 |
|
|
|
20 |
Select Case nType
|
|
|
21 |
Case 1
|
|
|
22 |
' Jan, 26 2003
|
|
|
23 |
'Response.write "MONTH"& mMonth &" "& sDate
|
|
|
24 |
FormatDate = MonthName ( mMonth, TRUE ) &", "& mDay &" "& mYear
|
|
|
25 |
|
|
|
26 |
End Select
|
|
|
27 |
|
|
|
28 |
End Function
|
|
|
29 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
30 |
Private Sub SplitDate ( sDate, ByRef outDay, ByRef outMonth, ByRef outYear )
|
|
|
31 |
outDay = DatePart ( "D", DateValue ( sDate ) )
|
|
|
32 |
outMonth = DatePart ( "M", DateValue ( sDate ) )
|
|
|
33 |
outYear = DatePart ( "YYYY", DateValue ( sDate ) )
|
|
|
34 |
|
|
|
35 |
End Sub
|
|
|
36 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
37 |
Public Function TextToHTML ( sString )
|
|
|
38 |
Dim mString
|
|
|
39 |
|
|
|
40 |
If (sString = "") OR IsNull(sString) Then Exit Function
|
|
|
41 |
|
|
|
42 |
mString = Server.HTMLEncode( sString )
|
|
|
43 |
mString = Replace(mString, VBNewLine, "<br>")
|
|
|
44 |
|
|
|
45 |
TextToHTML = mString
|
|
|
46 |
End Function
|
|
|
47 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
48 |
Private Sub Class_Initialize()
|
|
|
49 |
'// Perform action on creation of object. e.g. Set myObj = New ThisClassName
|
|
|
50 |
End Sub
|
|
|
51 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
52 |
Private Sub Class_Terminate()
|
|
|
53 |
'// Perform action on object disposal. e.g. Set myObj = Nothing
|
|
|
54 |
End Sub
|
|
|
55 |
'-----------------------------------------------------------------------------------------------------------------
|
|
|
56 |
End Class
|
|
|
57 |
%>
|