Come convertire la data della stringa in valore datetime
Ciao a tutti,
Usando JMP10 importo i dati csv con la data della stringa come yyyy-mm-dd-hh:mm:ss:SSSSS , example 2013-09-01-14:02:33:759000. Per jmp è CARATTERE
Come convertire questo formato di data stringa in un datetime "reale" (NUMERIC) come yyyy-mm-dd hh:mm:ss o yyyy/mm/dd h:m:s ?
Grazie
geof
Ri: Come convertire la data della stringa in valore datetime<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />Ho risolto il problema.
Il formato della tua stringa era 2013-09-01-14:02:33:759000
Il mio è 2013-09-01-14.02.33.759000
Grazie
Ri: Come convertire la data della stringa in valore datetimeCiao Michele,
Ho eseguito il tuo script e funziona bene
Ho eseguito lo script seguente con la colonna "Ora" in cui si trovano tutti i dati.
Ma ho ottenuto "." per tutti i dati 
Current DataTable();
New Column( "Column 3",
Numeric,
Continuous,
Format( "yyyy-mm-ddThh:mm:ss", 19, 0 ),
Input Format( "yyyy-mm-ddThh:mm:ss", 0 ),
Formula(
Parse Date(
Substr( :Time, 1, 10 ) || "T" || Substr( :Time, 12, 8 ) ||
"." || Substr( :Time, 21 )
)
)
)
Ri: Come convertire la data della stringa in valore datetimegeoff:
Prova ad aggiungere una nuova colonna alla tua tabella che è di tipo data/ora e inserisci i valori convertiti utilizzando una formula.Ecco un esempio:
New Table( "Time Example",
Add Rows( 1 ),
New Column( "Column 2",
Character,
Nominal,
Set Values( {"2013-09-01-14:02:33:759000"} )
),
New Column( "Column 3",
Numeric,
Continuous,
Format( "yyyy-mm-ddThh:mm:ss", 19, 0 ),
Input Format( "yyyy-mm-ddThh:mm:ss", 0 ),
Formula(
Parse Date(
Substr( :Column 2, 1, 10 ) || "T" || Substr( :Column 2, 12, 8 ) ||
"." || Substr( :Column 2, 21 )
)
)
)
)
Michael Haslam
Ri: Come convertire la data della stringa in valore datetimeCiao
Quando eseguo lo script, nessun errore, ma nessun cambiamento nei dati! ?
Ri: Come convertire la data della stringa in valore datetimeIl modo più semplice è probabilmente quello di convertire la data in qualcosa che JMP comprende come ISO-8601: aaaa-mm-ggThh:mm:ss.sss. Questa formula dovrebbe farlo (supponendo che la fonte sia in una colonna chiamata "d"):
Parse Date( Substr( :d, 1, 10 ) || "T" || Substr( :d, 12, 8 ) || "." || Substr( :d, 21 ); );
JSL per armeggiare interattivo:
s = "2013-09-01-14:02:33:759000";
t = Substr( s, 1, 10 ) || "T" || Substr( s, 12, 8 ) || "." || Substr( s, 21 );
Parse Date( t );