Visualizzazione dei risultati da 1 a 8 su 8
  1. #1
    Utente di HTML.it L'avatar di agenti
    Registrato dal
    Feb 2002
    Messaggi
    2,427

    funzione di formattazione (date)

    <%FUNCTION datashort(dtData)
    datashort = Day(dtData) & "/" & Month(dtData) & "/" & Right(Year(dtData) ,2)
    END FUNCTION %>

    in questo modo ottengo...
    datashort(data)

    2/9/05

    vorrei ottenere invece

    02/09/05

    grazie.

  2. #2
    Prova così:

    codice:
    <%
    FUNCTION datashort(dtData) 
       
       Dim gg, mm as string
    
       if Day(dtData) <= 9 then
          gg = "0" & Day(dtData)
       end if
    
       if Month(dtData) <= 9 then
          mm = "0" & Month(dtData)
       end if
       datashort = gg & "/" & mm & "/" & Right(Year(dtData) ,2) 
    END FUNCTION 
    %>
    Provare paura per un qualcosa che ti possa capitare nel futuro non ti evita quell'evento,ti fa soltanto vivere un presente sbagliato!

  3. #3
    Utente di HTML.it L'avatar di agenti
    Registrato dal
    Feb 2002
    Messaggi
    2,427
    ehi max...

    avevi perso qualcosa...

    <%
    FUNCTION datashort(dtData)

    Dim gg,mm

    if Day(dtData) <= 9 then
    gg = "0" & Day(dtData)
    else
    gg = Day(dtData)
    end if

    if Month(dtData) <= 9 then
    mm = "0" & Month(dtData)
    else
    mm = Month(dtData)

    end if

    datashort = gg & "/" & mm & "/" & Right(Year(dtData) ,2)
    END FUNCTION
    %>


    ciao.

  4. #4
    Scusami, hai ragione.
    Funziona?
    Provare paura per un qualcosa che ti possa capitare nel futuro non ti evita quell'evento,ti fa soltanto vivere un presente sbagliato!

  5. #5
    Utente di HTML.it L'avatar di agenti
    Registrato dal
    Feb 2002
    Messaggi
    2,427
    si...

    leggi pvt!

  6. #6
    Bene.
    Provare paura per un qualcosa che ti possa capitare nel futuro non ti evita quell'evento,ti fa soltanto vivere un presente sbagliato!

  7. #7
    Io risolsi in questo modo:

    codice:
    giorno = Day(tua_data)
    mese   = Month(tua_data)
    
    If len(giorno) < 2 then
    giorno = "0" & giorno
    Else
    giorno = giorno
    End if
    
    If len(mese) < 2 then
    mese = "0" & mese
    Else
    mese = mese
    End if

  8. #8
    perché invece non utilizzi FormatDateTime(data,0/1/2/3/4)?
    Ma onestamente, dài! Come si fa a chiamare vergine un CD che ci ha un buco in mezzo?!?.

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 © 2025 vBulletin Solutions, Inc. All rights reserved.