Hello, Imar!
Thanks for the quick reply and the great links! I adapted the second one to my needs and... yes! It worked perfectly! :)
Thank you very much indeed.
Best Regards,
fskilnik
P.S.: for the interested readers, I did the following:
01) Created a "functions.asp" file containing exactly the code written below (at the end of this post) ;
02) Put in my "*.asp" page the instruction "to read from it"
03) Put the code
<%=FormatingDate("%d %M %y", UDate((rsInvestorData.Fields.Item("dealingDate").V alue)))%>
to read my recordset "rsInvestorData" in the (desired) format "03 Jan 05".
That´s it!!
---------------- All Code in functions.asp ------------------------
<%
function UDate(oldDate)
UDate = DateDiff("s", "01/01/1970 00:00:00", oldDate)
end function
function unUDate(intTimeStamp)
unUDate = DateAdd("s", intTimeStamp, "01/01/1970 00:00:00")
end function
function FormatingDate(format, intTimeStamp)
Dim monthname()
Redim monthname(12)
monthname(1) = "January"
monthname(2) = "February"
monthname(3) = "March"
monthname(4) = "April"
monthname(5) = "May"
monthname(6) = "June"
monthname(7) = "July"
monthname(8) = "August"
monthname(9) = "September"
monthname(10) = "October"
monthname(11) = "November"
monthname(12) = "December"
dim unUDate, A
dim OriginalLocale
dim res
OriginalLocale = GetLocale
res = SetLocale("en-gb")
if not (isnumeric(intTimeStamp)) then
if isdate(intTimeStamp) then
intTimeStamp = DateDiff("s", "01/01/1970 00:00:00", intTimeStamp)
else
response.write "Date Invalid"
exit function
end if
end if
if (intTimeStamp=0) then
unUDate = now()
else
unUDate = DateAdd("s", intTimeStamp, "01/01/1970 00:00:00")
end if
unUDate = trim(unUDate)
dim startM : startM = 1
dim startD : startD = InStr(startM, unUDate, "/")+1
dim startY : startY = InStr(startD, unUDate, "/")+1
dim dateDay : dateDay = mid(unUDate, 1, (startM + 1))
dim dateMonth : dateMonth = mid(unUDate, startD, ((startY - 1) - startD))
dim dateYear : dateYear = mid(unUDate, startY, 4)
format = replace(format, "%y", right(dateYear, 2))
format = replace(format, "%m", dateMonth)
format = replace(format, "%M", left(monthname(cint(dateMonth)), 3))
format = replace(format, "%d", dateDay)
FormatingDate = format
res = SetLocale(OriginalLocale)
end function
%>
|