Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Output formato data

  1. #1
    Utente di HTML.it L'avatar di cms9651
    Registrato dal
    Mar 2010
    Messaggi
    107

    Output formato data

    Ciao.
    Servirebbe un aiuto.

    Questo codice ASP restituisce il seguente output 20/03/2012 22.51.42:
    codice:
    function TimestampToData(timestamp)
    	if IsNumeric(timestamp) then
    		TimestampToData = dateadd("s", timestamp, "01/01/1970 00.00.00")
    	else
    		TimestampToData = Now()
    	end if
    end function
    
    ...
    
    response.write TimestampToData(rs("data_ricevuto"))
    Non riesco ad ottenere invece questo output: Mar, 20 Mar 2012 22:53:16 +0100

    Come posso fare?
    grazie

  2. #2

    Re: Output formato data

    Originariamente inviato da cms9651
    Ciao.
    Servirebbe un aiuto.

    Questo codice ASP restituisce il seguente output 20/03/2012 22.51.42:
    codice:
    function TimestampToData(timestamp)
    	if IsNumeric(timestamp) then
    		TimestampToData = dateadd("s", timestamp, "01/01/1970 00.00.00")
    	else
    		TimestampToData = Now()
    	end if
    end function
    
    ...
    
    response.write TimestampToData(rs("data_ricevuto"))
    Non riesco ad ottenere invece questo output: Mar, 20 Mar 2012 22:53:16 +0100

    Come posso fare?
    grazie
    Prova così:
    codice:
    data_ricevuto = rs("data_ricevuto")
    response.write (FormatDateTime(data_ricevuto, 1) & " ")

  3. #3
    Utente di HTML.it L'avatar di cms9651
    Registrato dal
    Mar 2010
    Messaggi
    107
    Grazie per l'interessamento, ma non va.

    This page contains the following errors:

    error on line 1 at column 1: Document is empty
    Below is a rendering of the page up to the first error.

    codice:
    <%
    
    Set objconn = Server.CreateObject("ADODB.Connection")
    objconn.Open "DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;DATABASE=xxx;USER=xxx;PASSWORD=xxx;OPTION=3;"
    
    SQL = "SELECT SQL_CALC_FOUND_ROWS id, nome, data_ricevuto FROM tblxxx 1 order by id desc LIMIT 1;"
    Set rs = Server.CreateObject("ADODB.RecordSet")
    rs.Open SQL, objconn
    
    If not rs.eof then
    
    data_ricevuto = rs("data_ricevuto")
    response.write (FormatDateTime(data_ricevuto, 1) & " ")
    
    
    SQL = "SELECT FOUND_ROWS() x;"
    Set objRs = objconn.execute(SQL)
    
    xml = "<?xml version=""1.0"" encoding=""ISO-8859-1"" ?>" & _
          "<rss version=""2.0"">" & _
          "<channel>" & _     
          "<title>prova</title>" & _
          "<description>test</description>" & _
          "<link>http://www...../</link>" & _      
          "<language>it</language>"
    
      Do while not rs.eof
        xml = xml & "<item>"
        xml = xml & "<title>" & UCASE(rs("nome")) & "</title>"    
        xml = xml & "<description>" & formatnumber(objRs("x"),0) & "</description>" 
        xml = xml & "<link>....</link>" 
        xml = xml & "<pubDate>" & (FormatDateTime(data_ricevuto, 1)) & "</pubDate>"          
        xml = xml & "</item>"  
        rs.movenext
      Loop
      
      objRs.close
      set objRs=nothing
    
    End if
    
    xml = xml & "</channel></rss>"
    
    response.ContentType = "text/xml"
    response.write xml
    
    rs.close
    set rs=nothing
    
    objconn.Close
    set objconn=nothing
    %>

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.