Visualizzazione dei risultati da 1 a 7 su 7
  1. #1

    Da Date a Timestamp..come?!

    codice:
    	values.add(new Timestamp(new SimpleDateFormat("yyyy/MM/dd HH:mm").parse(String.valueOf(Data_Protocollo_Rif.getTime()))));
    Ragazzi provo questo per convertire da Date a Timestamp ma non è corretto..come posso fare?!
    [ SimplyMepis 8 ]Copyleft
    www.mepisitalia.org IL SITO ITALIANO UFFICIALE DI MEPIS
    www.salentomovida.it LA MOVIDA DEL SALENTO HA UN NUOVO PUNTO D'INCONTRO SUL WEB
    [ SUD SOUND SYSTEM MINA FUECU INTRA ALLU SALENTU ]

  2. #2
    Utente di HTML.it L'avatar di andbin
    Registrato dal
    Jan 2006
    residenza
    Italy
    Messaggi
    18,284

    Re: Da Date a Timestamp..come?!

    Originariamente inviato da alex86
    Ragazzi provo questo per convertire da Date a Timestamp ma non è corretto..come posso fare?!
    Se hai un Date, basta che ottieni il long (con i millisecondi) tramite getTime() e lo passi al costruttore di Timestamp.

    Es.
    Timestamp ts = new Timestamp (tuoDate.getTime());
    Andrea, andbin.devSenior Java developerSCJP 5 (91%) • SCWCD 5 (94%)
    java.util.function Interfaces Cheat SheetJava Versions Cheat Sheet

  3. #3
    scusa che cos'è Data_Protocollo_Rif? hai un metodo statico getTime()?
    no, perchè stai chiamando il metodo di un classe.. non so se è quello che volevi

  4. #4
    risolto grazie andbin
    [ SimplyMepis 8 ]Copyleft
    www.mepisitalia.org IL SITO ITALIANO UFFICIALE DI MEPIS
    www.salentomovida.it LA MOVIDA DEL SALENTO HA UN NUOVO PUNTO D'INCONTRO SUL WEB
    [ SUD SOUND SYSTEM MINA FUECU INTRA ALLU SALENTU ]

  5. #5
    Scusate,

    ma come faccio ad ottenere invece lo UNIX timestamp?

  6. #6
    Utente di HTML.it L'avatar di andbin
    Registrato dal
    Jan 2006
    residenza
    Italy
    Messaggi
    18,284
    Originariamente inviato da grifis78
    ma come faccio ad ottenere invece lo UNIX timestamp?
    Dividi i millisecondi per mille .... per avere i secondi.
    Andrea, andbin.devSenior Java developerSCJP 5 (91%) • SCWCD 5 (94%)
    java.util.function Interfaces Cheat SheetJava Versions Cheat Sheet

  7. #7
    Moderatore di Programmazione L'avatar di alka
    Registrato dal
    Oct 2001
    residenza
    Reggio Emilia
    Messaggi
    24,480

    Moderazione

    Originariamente inviato da grifis78
    Scusate,
    ma come faccio ad ottenere invece lo UNIX timestamp?
    In futuro, non risollevare discussioni concluse da tempo e vecchie addirittura di due anni: apri una nuova discussione per affrontare il tuo problema.
    MARCO BREVEGLIERI
    Software and Web Developer, Teacher and Consultant

    Home | Blog | Delphi Podcast | Twitch | Altro...

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.