Ir para conteúdo
Fórum Script Brasil
  • 0

Formatar Data


Guest mporto

Pergunta

Estou tentando formatar a data do meu blog para o português, mas sem sucesso. Ele está no formato 09/20/2005 e eu estou querendo colocar 20/09/2005. Olhando o código abaixo, alguém poderia me ajudar a resolver o problema?

<%@LANGUAGE="VBSCRIPT"%>

<!--#include file="include/common.asp" -->

<!--#include file="include/calendario.asp" -->

<%

Dim iMonth, iYear

Dim giorno, archivio

Dim data_blog

iMonth=Request ("month")

iYear=Request ("year")

if iMonth = "" then iMonth = Month(Now)

sMonth=NameFromMonth(iMonth)

if iYear = "" then iYear = Year(Now)

giorno=request.querystring("giorno")

archivio=request.querystring("archivio")

data_blog="#" & iMonth & "/" & giorno & "/" & iYear & "#"

Dim rsblog

Dim rscommenti

Dim vpage

Dim page

Dim Block

Dim Blocks

Dim i

Dim totale

Dim maxpages

Dim PagStart

Dim PagStop

Dim RemainingRecords

Dim msg

Block = Request.querystring("Block")

page = Request.querystring("page")

if Block="" then Block=1

if page="" then page=1

%>

<html>

<head>

<title><% = Ublogname %></title>

<!--#include file="include/metatag.inc" -->

<LINK href="include/styles.css" rel=stylesheet>

<!--BEGIN Pop-up Windows Script------------------------------------------>

<script Language="JavaScript">

<!--

// Copyright 1999 - 2002 by Ray Stott, Pop-up Windows Script ver 2.0

// OK to use if this copyright is included

// Script is available at http://www.crays.com/jsc

var popWin = null // use this when referring to pop-up window

var winCount = 0

var winName = "popWin"

function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){

var d_winLeft = 20 // default, pixels from screen left to window left

var d_winTop = 20 // default, pixels from screen top to window top

winName = "popWin" + winCount++ //unique name for each pop-up window

closePopWin() // close any previously opened pop-up window

if (openPopWin.arguments.length >= 4) // any additional features?

winFeatures = "," + winFeatures

else

winFeatures = ""

if (openPopWin.arguments.length == 6) // location specified

winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)

else

winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)

popWin = window.open(winURL, winName, "width=" + winWidth

+ ",height=" + winHeight + winFeatures)

}

function closePopWin(){ // close pop-up window if it is open

if (navigator.appName != "Microsoft Internet Explorer"

|| parseInt(navigator.appVersion) >=4) //do not close if early IE

if(popWin != null) if(!popWin.closed) popWin.close()

}

function getLocation(winWidth, winHeight, winLeft, winTop){

return ""

}

//-->

</SCRIPT>

<script Language="JavaScript1.2"> // for Netscape 4+ and IE 4+

<!--

function getLocation(winWidth, winHeight, winLeft, winTop){

var winLocation = ""

if (winLeft < 0)

winLeft = screen.width - winWidth + winLeft

if (winTop < 0)

winTop = screen.height - winHeight + winTop

if (winTop == "cen")

winTop = (screen.height - winHeight)/2 - 20

if (winLeft == "cen")

winLeft = (screen.width - winWidth)/2

if (winLeft>0 & winTop>0)

winLocation = ",screenX=" + winLeft + ",left=" + winLeft

+ ",screenY=" + winTop + ",top=" + winTop

else

winLocation = ""

return winLocation

}

//-->

</SCRIPT>

<!--END Pop-up Windows Script------------------------------------------->

</head>

<!--#include file="include/header.asp" -->

<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">

<!--#include file="include/menu.asp" -->

<tr>

<td colspan="2"><div class="hrgreen"><img src="immagini/spacer.gif"></div></td>

</tr>

<tr>

<td colspan="2" align="right"><u><% = strLangSelectArchivesBlog %></u> &nbsp;<img src="immagini/freccia.gif"><img src="immagini/freccia.gif">&nbsp;&nbsp;<font class="arancio"><b>

<%If giorno <> "" Then

response.write giorno & "&nbsp;" & Ucase(sMonth) & "&nbsp;" & iYear

elseif archivio<>"OK" then

response.write Ucase(sMonth) & "&nbsp;" & iYear

else

response.write strLangSelectArchivesBlogFull

end if %>

</b></font>&nbsp;</td>

</tr>

<tr>

<td colspan="2">&nbsp;</td>

</tr>

<tr>

<td colspan="2">&nbsp;</td>

</tr>

</table>

<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" height="250">

<tr>

<!--#include file="include/layer_sx.asp" -->

<td width="3" rowspan="2" background="immagini/punto.gif"><img src="immagini/bianco.gif"></td>

<td valign="top">

<%

Set rsblog = Server.CreateObject("ADODB.Recordset")

' verifico se la scelta è relativa ad un giorno specifico

' nel caso di giorno<>"" visualizzo tutti i blog relativi al giorno specificato

if giorno <> "" then

strSQL = "SELECT blog.* FROM blog WHERE data = " & data_blog & "ORDER BY blog_id DESC;"

msg = "<div align='center'><br><br><br>" & strLangErrorMessageNoBlog1 &""

msg = msg & "<br><br><a href='index.asp?archivio=OK'>" & strLangNavRedirectErrorNoBlog & "</a></div>"

' verifico se è stato scelto di visualizzare l'archivio completo ed in caso contrario, archivio <>OK, visualizzo i blog relativi al mese richiamato dal calendario

elseif archivio<>"OK" then

mese=Right(CStr(100+iMonth), 2)

strSQL = "SELECT blog.* FROM blog WHERE mese = '" & mese & "' AND anno = '" & iYear & "' ORDER BY blog_id DESC;"

msg = "<div align='center'><br><br><br>" & strLangErrorMessageNoBlog2 &""

msg = msg & "<br><br><a href='index.asp?archivio=OK'>" & strLangNavRedirectErrorNoBlog & "</a></div>"

else

' visualizzo tutto l'archivio blog

strSQL = "SELECT blog.* FROM blog ORDER BY blog_id DESC;"

msg = "<div align='center'><br><br><br>" & strLangErrorMessageNoBlog3 &""

end if

rsblog.Open strSQL, adoCon, 1, 3

rsblog.PageSize = intRecordsPerPage

If NOT rsblog.EOF Then rsblog.AbsolutePage = page

Set rscommenti = Server.CreateObject("ADODB.Recordset")

If rsblog.EOF Then

Response.Write msg

Response.End

Else

totale = rsblog.RecordCount

For i=1 to intRecordsPerPage

If rsblog.EOF Then Exit For

strSQL = "SELECT Count(commenti.blog_id) AS numerocommenti "

strSQL = strSQL & "FROM commenti "

strSQL = strSQL & "WHERE commenti.blog_id = " & CLng(rsblog("blog_id")) & ";"

rscommenti.Open strSQL, adoCon

%>

<table width="85%" border="0" cellspacing="0" cellpadding="2" align="center" class="tablemenu">

<tr>

<td width="70%"> <b>

<% = UCase(rsblog("blog_titolo")) %></b>&nbsp;&nbsp;<% = strLangGlobBy %><b>&nbsp;<%If rsblog("blog_email") <> "" Then Response.Write("<a href=""mailto:" & rsblog("blog_email") & """ >" & rsblog("blog_autore") & "</a>") Else Response.Write(rsblog("blog_autore")) %></b> </td>

<td align="right"><% = rsblog("data")%>&nbsp;<% = strLangGlobAt %>&nbsp;<% = FormatDateTime(rsblog("ora"),vbShortTime) %>

</td>

</tr>

<tr>

<td colspan="2">

<div class="hrgreen"><img src="immagini/spacer.gif"></div>

</td>

</tr>

<tr>

<td ALIGN="JUSTIFY" colspan="2">

<%

strText = rsblog("blog_testo")

Response.write anteprima(strText, 40)

%>

</td>

</tr>

<tr>

<td colspan="2">

<div class="hrgreen"><img src="immagini/spacer.gif"></div>

</td>

</tr>

<tr>

<td>

<%

If CBool(rsblog("commenti")) = True Then

%>

<a href="blog_commento.asp?blog_id=<% = rsblog("blog_id") %>&giorno=<% = giorno %>&year=<% = iYear %>&month=<% = iMonth %>&archivio=<% = archivio %>&#commento"><% = strLangFormSubmitComment %></a>

<%

If NOT rscommenti.EOF Then

Response.Write "&nbsp;[ " & strLangGlobNumberOfComment & " " & rscommenti("numerocommenti") & " ]"

Else

Response.Write "&nbsp;[ " & strLangGlobNumberOfComment & " 0 ]"

End If

End If

%>

</td>

<td align="right" class="back2"><img src="immagini/dettagli.gif">&nbsp;

<a href="blog_commento.asp?blog_id=<% = rsblog("blog_id") %>&giorno=<% = giorno %>&year=<% = iYear %>&month=<% = iMonth %>&giorno=<% = giorno %>&archivio=<% = archivio %>"><% = strLangGlobReadAll %></a> </td>

</tr>

</table>

<br><br>

<%

rscommenti.Close

rsblog.MoveNext

Next

End If

%>

<br><br>

<%

'paginazione

Response.Write "<table width=""90%"" align=""center"" border=""0"" cellspacing=""0"" cellpadding=""0"" height=""20""><tr><td align=""center"" width=""30%"">"

maxpages = int(totale / intRecordsPerPage)

if (totale mod intRecordsPerPage) <> 0 then

maxpages = maxpages + 1

end if

Blocks=0

Blocks = int(maxpages / PagesPerBlock)

if (maxpages mod PagesPerBlock) <> 0 then

Blocks = Blocks + 1

end if

Response.Write "" & strLangGlobPage & " " & page & " " & strLangGlobOf & " " & maxpages & "</td>"

Response.Write "<td align=""center"" width=""70%"">"

PagStop=Block*PagesPerBlock

PagStart=(PagStop-PagesPerBlock)+1

i=0

if maxpages>1 then

For vpage=PagStart to PagStop

i=i+1

if Block=1 then i=0

if i=1 and Block>1 then

Response.Write "<A href='" & request.servervariables("SCRIPT_NAME") & "?Block=" & _

(Block-1)& "&page=" & vpage-1 & "&month="& iMonth &"&year="& iYear &"&giorno=" & giorno & "&archivio="& archivio &"' title='" & strLangNavAltPagePrev & "'>" & _

"<img src='immagini/frecciasx.gif' border='0'><img src='immagini/frecciasx.gif' border='0'></A>&nbsp;&nbsp;"

end if

RemainingRecords = totale-(vpage*intRecordsPerPage)

if RemainingRecords > 0 then

if vpage=CInt(page) then

Response.Write"" & vpage & " "

else

Response.Write "<A href='" & request.servervariables("SCRIPT_NAME") & "?Block=" & Block & _

"&page=" & vpage & "&month="& iMonth &"&year="& iYear &"&giorno=" & giorno & "&archivio="& archivio &"'>" & vpage & "</A> "

end if

else

if vpage=CInt(page) then

Response.Write"" & vpage & " "

else

Response.Write "<A href='" & request.servervariables("SCRIPT_NAME") & "?Block=" & Block & _

"&page=" & vpage & "&month="& iMonth &"&year="& iYear &"&giorno=" & giorno & "&archivio="& archivio &"'>" & vpage & "</A> "

end if

exit for

end if

if vpage=PagStop AND Blocks>1 and int(Block-1)<int(Blocks) then

Response.Write "&nbsp;&nbsp;<A href='" & request.servervariables("SCRIPT_NAME") & "?Block=" & (Block+1) & _

"&page=" & vpage+1 & "&month="& iMonth &"&year="& iYear &"&giorno=" & giorno & "&archivio="& archivio &"' title='" & strLangNavAltPageNext & "'>" & _

"<img src='immagini/freccia.gif' border='0'><img src='immagini/freccia.gif' border='0'></A>"

end if

Next

end if

Response.Write "</td></tr></table>"

%>

<br>

<br>

<%

rsblog.Close

Set rsblog = Nothing

Set rscommenti = Nothing

Set strCon = Nothing

Set adoCon = Nothing

%>

</td>

</tr>

<tr>

<td>&nbsp;</td>

<td>&nbsp;</td>

</tr>

</table>

<!--#include file="include/footer.asp" -->

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,3k
×
×
  • Criar Novo...