Pagina 2 di 2 primaprima 1 2
Visualizzazione dei risultati da 11 a 17 su 17

Discussione: Problema con le DATE

  1. #11

    tela tiro fuori io la soluzione!!!

    premessa: il codice che stò per postare non è mio ma è di un'altra persona: la citerei volentieri ma sinceramente non ricordo il sito da cui proviene.
    Il problema si risolve scrivendo per esempio al posto di
    <% =RS("data") %>
    questo
    <% CONST DATE_FORMAT = "%d/%m/%Y" %>
    <% =DanDate(RS("data"), DATE_FORMAT) %>
    la costante basta scriverla una volta per esempio all'iniziodella pagina.
    fammi sapere sq con questo risolvi oppure no.
    saluti
    Baijo.


    'Parameter Description Example
    '%m Month as a decimal no. 02
    '%b Abbreviated month name Feb
    '%B Full month name February
    '%d Day of the month 23
    '%j Day of the year 54
    '%y Year without century 98
    '%Y Year with century 1998
    '%w Weekday as integer 5 (0 is Sunday)
    '%a Abbreviated day name Fri
    '%A Weekday Name Friday
    '%I Hour in 12 hour format 12
    '%H Hour in 24 hour format 24
    '%M Minute as an integer 01
    '%S Second as an integer 55
    '%P AM/PM Indicator PM
    '%% Actual Percent sign %%
    ' %d/%m%/%Y %H:%M

    Function DanDate (strDate, strFormat)

    Dim intPosItem
    Dim intHourPart
    Dim strHourPart
    Dim strMinutePart
    Dim strSecondPart
    Dim strAMPM


    If not IsDate(strDate) Then
    DanDate = strDate
    Exit Function
    End If

    intPosItem = Instr(strFormat, "%m")
    Do While intPosItem > 0
    strFormat = Left(strFormat, intPosItem-1) & _
    DatePart("m",strDate) & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%m")
    Loop

    intPosItem = Instr(strFormat, "%b")
    Do While intPosItem > 0
    strFormat = Left(strFormat, intPosItem-1) & _
    MonthName(DatePart("m",strDate),True) & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%b")
    Loop

    intPosItem = Instr(strFormat, "%B")
    Do While intPosItem > 0
    strFormat = Left(strFormat, intPosItem-1) & _
    MonthName(DatePart("m",strDate),False) & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%B")
    Loop

    intPosItem = Instr(strFormat, "%d")
    Do While intPosItem > 0
    strFormat = Left(strFormat, intPosItem-1) & _
    DatePart("d",strDate) & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%d")
    Loop

    intPosItem = Instr(strFormat, "%j")
    Do While intPosItem > 0
    strFormat = Left(strFormat, intPosItem-1) & _
    DatePart("y",strDate) & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%j")
    Loop

    intPosItem = Instr(strFormat, "%y")
    Do While intPosItem > 0
    strFormat = Left(strFormat, intPosItem-1) & _
    Right(DatePart("yyyy",strDate),2) & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%y")
    Loop

    intPosItem = Instr(strFormat, "%Y")
    Do While intPosItem > 0
    strFormat = Left(strFormat, intPosItem-1) & _
    DatePart("yyyy",strDate) & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%Y")
    Loop

    intPosItem = Instr(strFormat, "%w")
    Do While intPosItem > 0
    strFormat = Left(strFormat, intPosItem-1) & _
    DatePart("w",strDate,1) & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%w")
    Loop

    intPosItem = Instr(strFormat, "%a")
    Do While intPosItem > 0
    strFormat = Left(strFormat, intPosItem-1) & _
    WeekDayName(DatePart("w",strDate,1),True) & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%a")
    Loop

    intPosItem = Instr(strFormat, "%A")
    Do While intPosItem > 0
    strFormat = Left(strFormat, intPosItem-1) & _
    WeekDayName(DatePart("w",strDate,1),False) & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%A")
    Loop

    intPosItem = Instr(strFormat, "%I")
    Do While intPosItem > 0
    intHourPart = DatePart("h",strDate) mod 12
    if intHourPart = 0 then intHourPart = 12
    strFormat = Left(strFormat, intPosItem-1) & _
    intHourPart & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%I")
    Loop

    intPosItem = Instr(strFormat, "%H")
    Do While intPosItem > 0
    strHourPart = DatePart("h",strDate)
    if strHourPart < 10 Then strHourPart = "0" & strHourPart
    strFormat = Left(strFormat, intPosItem-1) & _
    strHourPart & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%H")
    Loop

    intPosItem = Instr(strFormat, "%M")
    Do While intPosItem > 0
    strMinutePart = DatePart("n",strDate)
    if strMinutePart < 10 then strMinutePart = "0" & strMinutePart
    strFormat = Left(strFormat, intPosItem-1) & _
    strMinutePart & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%M")
    Loop

    intPosItem = Instr(strFormat, "%S")
    Do While intPosItem > 0
    strSecondPart = DatePart("s",strDate)
    if strSecondPart < 10 then strSecondPart = "0" & strSecondPart
    strFormat = Left(strFormat, intPosItem-1) & _
    strSecondPart & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%S")
    Loop

    intPosItem = Instr(strFormat, "%P")
    Do While intPosItem > 0
    if DatePart("h",strDate) >= 12 then
    strAMPM = "PM"
    Else
    strAMPM = "AM"
    End If
    strFormat = Left(strFormat, intPosItem-1) & _
    strAMPM & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%P")
    Loop

    intPosItem = Instr(strFormat, "%%")
    Do While intPosItem > 0
    strFormat = Left(strFormat, intPosItem-1) & "%" & _
    Right(strFormat, Len(strFormat) - (intPosItem + 1))
    intPosItem = Instr(strFormat, "%%")
    Loop

    DanDate = strFormat

    End Function
    -----------------------------------
    http://www.nrsdesign.it
    Il sito dei webdoctor italiani
    -----------------------------------

  2. #12
    Anch'io ho lo stesso problema, qualcuno ha trovato una soluzione definitiva? Quella proposta da Baijo sembra funzionare, però è una "toppa": il problema resta! MaStEr85, come hai risolto il problema? Sul mio Pc ha iniziato a fare così dopo che ho reinstallato Win2000, ma ora non c'è verso di tornare indietro!

    Ciao e grazie

    SuperG

  3. #13
    Utente di HTML.it
    Registrato dal
    Feb 2002
    residenza
    Cittá del Messico (Messico)
    Messaggi
    610
    verifica se nelle impostazioni della lingua di sistema, di solito ci accedi anche dall'iconcina accanto all'orologio ( se c'è) che esista solo lingua italiana e non italiana e americana insieme ok.

    ciao
    M.Solazzi
    from
    Mexico City!!

  4. #14

    IDEM

    Anchio ho lo stesso problema: richiamando <%=Date()%> visualizzo /08/aa.
    Ho notato che appena installato iis anche la proprietà ultima modifica dei file era in questo formato, poi ho cambiato il formato in impostazioni internazionali e i file sono tornati apposto.
    Il problema però rimane richiamando la data in asp ma sopratutto caricando una data da db!

    Se il tuo problema è solo nella visualizzazione prova a caricare prima il giorno poi il mese poi l'anno, cosi:
    day(now)&"/"&month(now)&"/"&year(now)
    io l'ho risolto cosi per la visualizzazione.

    Spero che qualcuno mi aiuti.

  5. #15
    Mannaggia...
    Avevo già trovato la soluzione una volta a questo problema...
    Se non ricordo male era una specie di bug ... non riesco a trovare la discussione...

  6. #16
    Mi sa tanto che l'unica soluzione e' quella di Formattare tutto !!!!
    What's ?

  7. #17
    Avevo anch'io lo stesso problema, e dopo una (lunga) ricerca ho trovato la risposta proprio in Microsoft:
    è stato sufficiente modificare l'impostazione del registro di configurazione del server come segue...
    HKEY_USERS\.DEFAULT\Control Panel\International\Locale = 00000409
    se vuoi leggerti tutto l'articolo eccoti l'indirizzo...
    http://support.microsoft.com/default...EN-US;Q264063&
    Ciao.

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.