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

Data E Hora


Guest R Faria

Pergunta

Num entendo quase nada de asp...

Peguei um código pronto e estou fazendo algumas alterações...

O código para data e hora é:

<% = FormatDateTime(dtmEntryDate, VbLongDate) %>

<% = FormatDateTime(dtmEntryDate, VbShortTime) %>

Aí a data aparece em inglês, como posso converter isso?

Link para o comentário
Compartilhar em outros sites

Posts Recomendados

  • 0
no inicio da page, já coloquei e corrigiu a data..

mas você viu q a hora ta atrasada?

ops, desculpa.. agora é q eu entendi...rs

Estou postando a page toda

<% Option Explicit %>

<!--#include file="common.inc" -->

'Buffer the response

Response.Buffer = True

'Dimension variables

Dim adoRec 'Database Recordset Variable

Dim strName 'Holds the Users name

Dim strEmailAddress 'Holds the Users e-mail address

Dim strCountry 'Holds the users country

Dim strHomepage 'Holds the Users homepage

Dim strComments 'Holds the Users comments

Dim dtmEntryDate 'Holds the date the commnets where made

Dim intRecordPositionPageNum 'Holds the record position

Dim intRecordLoopCounter 'Loop counter for displaying the guestbook records

Dim intTotalNumGuestbookEntries 'Holds the total number of records in the database

Dim intTotalNumGuestbookPages 'Holds the total number of pages in the database

Dim intLinkPageNum 'Holds the page number to be linked to

'If this is the first time the page is displayed then the guestbook record position is set to page 1

If Request.QueryString("PagePosition") = "" Then

intRecordPositionPageNum = 1

'Else the page has been displayed before so the guestbook record postion is set to the Record Position number

Else

intRecordPositionPageNum = CInt(Request.QueryString("PagePosition"))

End If

'Create recorset object

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

'Initalise the strSQL variable with an SQL statement to query the database by selecting all tables ordered by the decending date

strSQL = "SELECT tblComments.* FROM tblComments ORDER BY Date DESC;"

'Set the cursor type property of the record set to dynamic so we can naviagate through the record set

adoRec.CursorType = 3

'Query the database

adoRec.Open strSQL, adoCon

'Set the number of records to display on each page by the constant set at the top of the script

adoRec.PageSize = intRecordsPerPage

'Get the guestbook record poistion to display from

If NOT adoRec.EOF Then adoRec.AbsolutePage = intRecordPositionPageNum

%>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Guest Book</title>

<!-- The Web Wiz Guide ASP Guestbook is written by Bruce Corkhill ©2001

If you want your Guestbook then goto http://www.webwizguide.com -->

<style type="text/css">

<!--

.text {font-family: <% = strTextType %>; font-size: <% = intTextSize %>px; color: <% = strTextColour %>}

.bold {font-family: <% = strTextType %>; font-size: <% = intTextSize %>px; color: <% = strTextColour %>; font-weight: bold;}

a {font-family: <% = strTextType %>; font-size: <% = intTextSize %>px; color: <% = strLinkColour %>}

a:hover {font-family: <% = strTextType %>; font-size: <% = intTextSize %>px; color: <% = strHoverLinkColour %>}

a:visited {font-family: <% = strTextType %>; font-size: <% = intTextSize %>px; color: <% = strVisitedLinkColour %>}

a:visited:hover {font-family: <% = strTextType %>; font-size: <% = intTextSize %>px; color: <% = strHoverLinkColour %>}

-->

</style>

</head>

<body bgcolor="<% = strBgColour %>" text="<% = strTextColour %>">

<!--#include file="header.inc" -->

<font face="Arial" style="font-size: 8pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

----------------------------------------------------------------------------------------------------------------------------------------------------------------</font>

<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" height="8">

<tr valign="middle">

<td height="14">

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

<tr>

<td width="70%"align="center" class="text">

<font face="Tahoma" style="font-size: 8pt"><br>

Bem Vindo ao Livro de Visitas KONECTANDO.com. As mensagens são de

inteira responsabilidade de quem as escreveu.<br>

</font><font face="Tahoma" size="2">

<br>

<a href="sign.asp?PagePosition=<% = intRecordPositionPageNum %>">

Assinar o Livro de Visitas</a></font></td>

</tr>

</table>

</td>

</tr>

</table>

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

<tr>

<td align="center" class="text">

<%

Session.LCID = 1046

%>

<%

'If there are no rcords in the database display an error message

If adoRec.EOF Then

'Tell the user there are no records to show

Response.Write "<br>There are no records in the guestbook database"

Response.Write "<br>Please check back later"

Response.End

'Display the guestbook

Else

'Count the number of enties in the guestbook database

intTotalNumGuestbookEntries = adoRec.RecordCount

'Count the number of pages there are in the guestbook database calculated by the PageSize attribute set above

intTotalNumGuestbookPages = adoRec.PageCount

'Display the HTML number number the total number of pages and total number of records in the guestbook database

%><font face="Tahoma" size="2"> </font>

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

<tr>

<td align="center" class="text"> <font face="Tahoma" size="2"> <br>

<% = intTotalNumGuestbookEntries %> mensagens em

<% = intTotalNumGuestbookPages %> páginas. Você está na página

<% = intRecordPositionPageNum %> </font>

</td>

</tr>

</table>

<font face="Tahoma" size="2">

<br>

<%

'For....Next Loop to display records from the guestbook database

For intRecordLoopCounter = 1 to intRecordsPerPage

'If there are no guestbook records left to display then exit loop

If adoRec.EOF Then Exit For

'Read in the values form the database

strName = adoRec("Name")

strCountry = adoRec("Country")

strEmailAddress = adoRec("EMail")

dtmEntryDate = CDate(adoRec("Date"))

strHomepage = adoRec("Homepage")

strComments = adoRec("Comments")

'Write the HTML to the web browser to display the guestbook entries

%> </font>

<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center" bgcolor="<% = strTableBorderColour %>">

<tr>

<td>

<table width="100%" border="0" cellpadding="2" cellspacing="0">

<tr bgcolor="<% = strTableTitleColour %>">

<td colspan="2" class="text"><font face="Tahoma" size="2">

Comentário de <a href="mailto:<% = strEmailAddress %>"><% = strName %></a>

-

<% = FormatDateTime(dtmEntryDate, VbLongDate) %> às <% = FormatDateTime(dtmEntryDate, VbShortTime) %>

</font>

</td>

</tr>

<tr>

<td colspan="2" bgcolor="<% = strTableColour %>" class="text"><% = strComments %><font face="Tahoma" size="2">

</font>

</td>

</tr>

<tr bgcolor="<% = strTableTitleColour %>">

<td width="50%" align="left" class="text"><% = strCountry %></td>

<td width="50%" align="right" class="text"><% = strHomepage %></td>

</tr>

</table>

</td>

</tr>

</table>

<font face="Tahoma" size="2">

<br>

<%

'Move to the next record in the database

adoRec.MoveNext

'Loop back round

Next

End If

'Display an HTML table with links to the other entries in the guestbook

%> </font>

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

<tr>

<td>

<table width="100%" border="0" cellpadding="0" cellspacing="0">

<tr><font face="Tahoma" size="2"><a href="http://www.webwizguide.com"></a>

</font>

<td width="50%" align="center" class="text">

<%

'If there are more pages to display then add a title to the other pages

If intRecordPositionPageNum > 1 or NOT adoRec.EOF Then

Response.Write vbCrLf & " Páginas:&nbsp;&nbsp;"

End If

'If the guestbook page number is higher than page 1 then display a back link

If intRecordPositionPageNum > 1 Then

Response.Write vbCrLf & " <a href=""default.asp?PagePosition=" & intRecordPositionPageNum - 1 & """ target=""_self"">&lt;&lt;&nbsp;Anterior</a>&nbsp;"

End If

'If there are more pages to display then display links to all the pages

If intRecordPositionPageNum > 1 or NOT adoRec.EOF Then

'Display a link for each page in the guestbook

For intLinkPageNum = 1 to intTotalNumGuestbookPages

'If the page to be linked to is the page displayed then don't make it a hyper-link

If intLinkPageNum = intRecordPositionPageNum Then

Response.Write vbCrLf & " " & intLinkPageNum

Else

Response.Write vbCrLf & " &nbsp;<a href=""default.asp?PagePosition=" & intLinkPageNum & """ target=""_self"">" & intLinkPageNum & "</a>&nbsp;"

End If

Next

End If

'If it is Not the End of the guestbook entries then display a next link for the next guestbook page

If NOT adoRec.EOF then

Response.Write vbCrLf & " &nbsp;<a href=""default.asp?PagePosition=" & intRecordPositionPageNum + 1 & """ target=""_self"">Próxima&nbsp;&gt;&gt;</a>"

End If

'Finsh HTML the table

%><font face="Tahoma"><font size="2"> </font>

</td>

</tr>

</table>

</td>

</tr>

</table>

<%

'Reset Server Variables

Set adoCon = Nothing

Set strCon = Nothing

Set adoRec = Nothing

%><font size="2"> </font></font>

</td>

</tr>

</table>

<div align="center"><br>

<br>

</div>

</body>

</html>

Link para o comentário
Compartilhar em outros sites

  • 0

Fiz:

A linha antes tava assim:

<% = FormatDateTime(dtmEntryDate, VbShortTime) %>

substitui pelo codigo

<%= now()%>

aí todos os comentários ficam com a mesma hora...

da uma olhada lá no link..

Ou brigadão pela ajuda!

Link para o comentário
Compartilhar em outros sites

  • 0

volta o que estava antes

depois cria um novo arquivo chamado

hora.asp

coloque no servidor com isto dentro do arquivo

<%= now()%>

ve a responsta, o que acontece......issso vai verificar a hora do servidor

Link para o comentário
Compartilhar em outros sites

  • 0

volta o que estava antes

depois cria um novo arquivo chamado

hora.asp

coloque no servidor com isto dentro do arquivo

<%= now()%>

ve a responsta, o que acontece......issso vai verificar a hora do servidor

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.


  • Estatísticas dos Fóruns

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