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

    [JAVA] gestione date

    Salve ragazzi ho una stringa contenente la data nel seguente formato: Wed Mar 08 16:47:38 CET 2006
    Adesso vorrei convertire questa data (di tipo stringa) nel seguente formato: yyyy-mm-dd hh:mm:ss.fffffffff

    Come posso fare??
    Grazie

  2. #2

  3. #3
    pozzad ho visto il link che mi hai postato, ma nn sono riuscito a capirci molto ... se mi daresti qualche altra indicazione, ti sarei grato per sempre...ho una immediata consegna e sto ancora in alto mare!!!

    Grazie

  4. #4
    Ecco qua
    codice:
    		SimpleDateFormat sdfInput = new SimpleDateFormat( "EEE MMM dd HH:mm:ss zzz yyyy", Locale.US ); 
    		String textDate = "Wed Mar 08 16:47:38 CET 2006"; 
    		Date date = null;
    		try {
    			date = sdfInput.parse( textDate );
    		} catch (ParseException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		} 
    
    		SimpleDateFormat sdfOutput = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss.SSS" );
    		String result = sdfOutput.format( date );

  5. #5
    Mi ritorna il seguente errore:

    codice:
    StoreUserRequestServlet.java:148: cannot resolve symbol
    symbol  : variable Locale
    location: class StoreUserRequestServlet
    SimpleDateFormat sdfInput = new SimpleDateFormat( "EEE MMM dd HH:mm:ss zzz yyyy", Locale.US );
    Ancora grazie

  6. #6
    Devi mettere l'import:

    import java.util.Locale

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