Umwandeln: Unterschied zwischen den Versionen
Aus Asprova Hilfe
GK (Diskussion | Beiträge) |
GK (Diskussion | Beiträge) (Überarbeitung und Formatierung) |
||
| Zeile 1: | Zeile 1: | ||
| − | {{DISPLAYTITLE: | + | {{DISPLAYTITLE:Umwandeln}} |
<div align="right">Hilfe Nummer: 741520</div> | <div align="right">Hilfe Nummer: 741520</div> | ||
| − | |||
<div align="right">[[Interne Funktionen|Interne Funktion]]</div> | <div align="right">[[Interne Funktionen|Interne Funktion]]</div> | ||
<div align="right">[[Formeleditor|Formeldialog]]</div> | <div align="right">[[Formeleditor|Formeldialog]]</div> | ||
<hr> | <hr> | ||
| − | |||
| − | + | Asprova stellt Ihnen die folgenden Funktionen zur Umwandlung von Daten in andere Datentypen zur Verfügung. | |
| − | + | == Datum, Zeit oder Zahl in String umwandeln == | |
| − | Format( value, expr ) | + | === Format( value, expr) === |
| − | + | {| class="wikitable" | |
| − | |||
| − | |||
| − | |||
| − | {| | ||
|- | |- | ||
| − | | | + | !rowspan="2"|Argumente |
| + | |''value''||colspan="2"|Zu formatierendes Datum/Zeit/Zahl | ||
|- | |- | ||
| − | || | + | |''expr''||colspan="2"|Struktur des Rückgabewerts |
|- | |- | ||
| − | + | !Rückgabewert | |
| − | + | |colspan="3"|Gibt ''value'' entsprechend den Vorgaben in ''expr'' formatiert zurück. | |
| − | Rückgabewert | ||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !rowspan="7"|Beispiele |
| + | |<code>Format(ME.StartTime,'h:m:s')</code>||"5:4:23"||rowspan="4"|''<code>ME.StartTime</code> ist der 27.01.2020 17:14:23.'' | ||
|- | |- | ||
| − | | | + | |<code>Format(ME.StartTime,'hh:mm:ss tt')</code>||"05:04:23 PM" |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | |<code>Format(ME.StartTime,'dddd, MMM d yyyy') </code>||"Montag, Jan 27 2020" |
|- | |- | ||
| − | | | + | |<code>Format(ME.StartTime,'HH:mm:ss') </code>||"17:04:23" |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | |<code>Format(5459.4,'##,##0.00')</code>||colspan="2"|"5,459.40" |
|- | |- | ||
| − | | | + | |<code>Format(334.9,'###0.00')</code>||colspan="2"|"334.90" |
| − | |||
| − | < | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | |<code>Format(5,'0.00%')</code>||colspan="2"|"500.00%" |
|- | |- | ||
| − | || | + | !Hinweis |
| + | |colspan="3"|Entspricht weitgehende der Format()-Funktion in Visual Basic. | ||
|- | |- | ||
|} | |} | ||
| − | + | == String in Zahl umwandeln == | |
| − | + | === FindNumberL( str, count ) === | |
| − | + | {| class="wikitable" | |
| − | {| | ||
|- | |- | ||
| − | | | + | !rowspan="2"|Argumente |
| + | |''str''||Quellstring | ||
|- | |- | ||
| − | | | + | |''count''||Integer, Position der Zahl |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !Rückgabewert |
| + | |colspan="2"|Gibt die ''count''-te Zahl in ''str'' zurück. | ||
|- | |- | ||
| − | | | + | !rowspan="3"|Beispiele |
| − | + | |<code>FindNumberL('Year:2020 Month6 Day1',1)</code>||2020 | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | |<code>FindNumberL('Year:2020 Month6 Day1',2)</code>||6 |
|- | |- | ||
| − | || | + | |<code>FindNumberL('Year:2020 Month6 Day1',2)</code>||1 |
|- | |- | ||
|} | |} | ||
| − | + | === FindNumberR( str, count ) === | |
| − | + | {| class="wikitable" | |
| − | |||
| − | {| | ||
|- | |- | ||
| − | | | + | !rowspan="2"|Argumente |
| + | |''str''||Quellstring | ||
|- | |- | ||
| − | | | + | |''count''||Integer, Position der Zahl |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !Rückgabewert |
| + | |colspan="2"|Gibt die ''count''-te Zahl von rechts in ''str'' zurück. | ||
|- | |- | ||
| − | | | + | !rowspan="3"|Beispiele |
| − | + | |<code>FindNumberR('Year:2020 Month6 Day1',1)</code>||1 | |
| − | < | ||
| − | < | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | |<code>FindNumberR('Year:2020 Month6 Day1',2)</code>||6 |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | |<code>FindNumberR('Year:2020 Month6 Day1',2)</code>||2020 |
|- | |- | ||
|} | |} | ||
| − | + | == Datum in Zahl umwandeln == | |
| − | + | === GetYearPart( time ) === | |
| − | + | {| class="wikitable" | |
| − | |||
| − | |||
| − | |||
| − | {| | ||
|- | |- | ||
| − | | | + | !Argument |
| + | |''time''||Zielzeit | ||
|- | |- | ||
| − | | | + | !Rückgabewert |
| − | + | |colspan="2"|Gibt das Jahr von ''time'' zurück. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !Beispiel |
| + | |<code>GetYearPart(#2020/6/1 12:30:00#)</code>||2020 | ||
|- | |- | ||
|} | |} | ||
| − | + | === GetMonthPart( time ) === | |
| − | + | {| class="wikitable" | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | {| | ||
|- | |- | ||
| − | | | + | !Argument |
| + | |''time''||Zielzeit | ||
|- | |- | ||
| − | | | + | !Rückgabewert |
| − | + | |colspan="2"|Gibt den Monat von ''time'' zurück. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !Beispiel |
| + | |<code>GetMonthPart(#2020/6/1 12:30:00#)</code>||6 | ||
|- | |- | ||
|} | |} | ||
| − | + | === GetDayPart( time ) === | |
| − | + | {| class="wikitable" | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | {| | ||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !Argument |
| − | + | |''time''||Zielzeit | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !Rückgabewert |
| + | |colspan="2"|Gibt den Tag von ''time'' zurück. | ||
|- | |- | ||
| − | | | + | !Beispiel |
| + | |<code>GetDayPart(#2020/6/1 12:30:00#)</code>||1 | ||
|- | |- | ||
|} | |} | ||
| − | + | === GetHourPart( time ) === | |
| − | + | {| class="wikitable" | |
| − | |||
| − | {| | ||
|- | |- | ||
| − | | | + | !Argument |
| + | |''time''||Zielzeit | ||
|- | |- | ||
| − | | | + | !Rückgabewert |
| − | + | |colspan="2"|Gibt die Stunde von ''time'' zurück. | |
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !Beispiel |
| + | |<code>GetHourPart(#2020/6/1 12:30:00#)</code>||12 | ||
|- | |- | ||
|} | |} | ||
| − | + | === GetMinutePart( time ) === | |
| − | + | {| class="wikitable" | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | {| | ||
|- | |- | ||
| − | | | + | !Argument |
| + | |''time''||Zielzeit | ||
|- | |- | ||
| − | || | + | !Rückgabewert |
| + | |colspan="2"|Gibt die Minute von ''time'' zurück. | ||
|- | |- | ||
| − | + | !Beispiel | |
| − | | | + | |<code>GetMinutePart(#2020/6/1 12:30:00#)</code>||0 |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
|} | |} | ||
| − | + | === GetSecondPart( time ) === | |
| − | + | {| class="wikitable" | |
| − | |||
| − | {| | ||
|- | |- | ||
| − | | | + | !Argument |
| + | |''time''||Zielzeit | ||
|- | |- | ||
| − | + | !Rückgabewert | |
| − | | | + | |colspan="2"|Gibt die Sekunde von ''time'' zurück. |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !Beispiel |
| + | |<code>GetSecondPart(#2020/6/1 12:30:00#)</code>||0 | ||
|- | |- | ||
|} | |} | ||
| − | + | == Datum in Zeit umwandeln == | |
| − | + | === GetTimePart( time ) === | |
| − | + | {| class="wikitable" | |
| − | |||
| − | |||
| − | |||
| − | {| | ||
|- | |- | ||
| − | | | + | !Argument |
| + | |''time''||Zielzeit | ||
|- | |- | ||
| − | || | + | !Rückgabewert |
| + | |colspan="2"|Gibt die Zeit von ''time'' zurück. | ||
|- | |- | ||
| − | || | + | !rowspan="2"|Beispiele |
| + | |<code>GetTimePart(#2020/6/1 12:30:00#)</code>||12H30M | ||
|- | |- | ||
| − | | | + | |<code>GetTimePart(now())</code>||Aktuelle Zeit |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
|} | |} | ||
| − | + | == Zeit in Zeit umwandeln == | |
| − | + | === ConvertTime( time, unit ) === | |
| − | + | {| class="wikitable" | |
| − | {| | ||
|- | |- | ||
| − | | | + | !rowspan="2"|Argumente |
| + | |''time''||colspan="2"|Zielzeit | ||
|- | |- | ||
| − | | | + | |''unit''||colspan="2"|Basiseinheit der Umwandlung - Sekunde, Minute, Stunde oder Tag |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !Rückgabewert |
| + | |colspan="3"|Gibt ''time'' als Zahl zurück. | ||
|- | |- | ||
| − | | | + | !rowspan="3"|Beispiele |
| − | + | |<code>ConvertTime(350s,'m')</code>||5||''5m + 50s, Sekunden werden abgerundet.'' | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | |<code>ConvertTime(350s,'M')</code>||6||''5m + 50s, Sekunden werden aufgerundet.'' |
|- | |- | ||
| − | | | + | |<code>ConvertTime(1.6H,'H')</code>||2||''1h + 36m, Minuten werden aufgerundet.'' |
|- | |- | ||
| − | || | + | !Hinweis |
| + | |colspan="3"|Erlaubte Werte für ''unit'' sind | ||
| + | * Abrunden - s, m, h, d | ||
| + | * Aufrunden - S, M, H, D | ||
|- | |- | ||
|} | |} | ||
| − | + | == Zahl in Datum umwandeln == | |
| − | + | === DateF( year, month, day, hour, minute, second ) === | |
| − | + | {| class="wikitable" | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | {| | ||
|- | |- | ||
| − | | | + | !rowspan="6"|Argumente |
| + | |''year''||Integer, Jahr | ||
|- | |- | ||
| − | + | |''month''||Integer, Monat | |
| − | | | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | |''day''||Integer, Tag |
|- | |- | ||
| − | | | + | |''hour''||Integer, Stunde |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | |''minute''||Integer, Minute |
|- | |- | ||
| − | | | + | |''second''||Integer, Sekunde |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | | | ||
| − | |||
|- | |- | ||
| − | | | + | !Rückgabewert |
| − | + | |colspan="2"|Gibt ''year'', ''month'', ''day'', ''hour'', ''minute'' & ''second'' als Datum zurück. | |
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !Beispiel |
| + | |<code>DateF(2020,6,15,6,30,30)</code>||2020/06/15 06:30:30 | ||
|- | |- | ||
| + | !Hinweis | ||
| + | |colspan="2"|Das "F" in <code>DateF()</code> steht für "vollständig" ("full"), da alle Elemente des Datums vorgegeben werden können. | ||
|} | |} | ||
| − | + | === DateS( year, month, day ) === | |
| − | + | {| class="wikitable" | |
| − | |||
| − | {| | ||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !rowspan="3"|Argumente |
| − | + | |''year''||Integer, Jahr | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | |''month''||Integer, Monat |
|- | |- | ||
| − | | | + | |''day''||Integer, Tag |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !Rückgabewert |
| + | |colspan="2"|Gibt ''year'', ''month'' & ''day'' als Datum zurück. | ||
|- | |- | ||
| − | + | !Beispiel | |
| − | + | |<code>DateS(2020,6,15)</code>||2020/06/15 00:00:00 | |
| − | Beispiel | ||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !Hinweise |
| + | |colspan="2"| | ||
| + | * Das "S" in <code>DateS()</code> steht für "einfach" ("simple"), da keine Uhrzeit vorgegeben werden kann. | ||
| + | * Die [Tagestrennzeit] der Projekteigenschaften wird nicht berücksichtigt. | ||
|- | |- | ||
|} | |} | ||
| − | + | === DateT( year, month, day, time ) === | |
| − | + | {| class="wikitable" | |
| − | |||
| − | {| | ||
|- | |- | ||
| − | | | + | !rowspan="4"|Argumente |
| + | |''year''||Integer, Jahr | ||
|- | |- | ||
| − | | | + | |''month''||Integer, Monat |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | |''day''||Integer, Tag |
|- | |- | ||
| − | | | + | |''time''||Integer, Zeitspane |
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !Rückgabewert |
| + | |colspan="2"|Gibt ''year'', ''month'', ''day & ''time'' als Datum zurück. | ||
|- | |- | ||
| − | | | + | !rowspan="3"|Beispiele |
| − | + | |<code>DateT(2020,6,15,6H)</code>||2020/06/15 06:00:00 | |
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | |<code>DateT(2020,6,15,6M)</code>||2020/06/15 00:06:00 |
|- | |- | ||
| − | | | + | |<code>DateT(2020,6,15,6S)</code>||2020/06/15 00:00:06 |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| − | | | + | !Hinweise |
| + | |colspan="2"|Das "T" in <code>DateT()</code> steht für "Zeitspanne" ("time span"). | ||
|- | |- | ||
|} | |} | ||
<hr> | <hr> | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
<hr> | <hr> | ||
<div align="right">Hilfe Nummer: 741520</div> | <div align="right">Hilfe Nummer: 741520</div> | ||
Version vom 7. Januar 2019, 22:33 Uhr
Hilfe Nummer: 741520
Asprova stellt Ihnen die folgenden Funktionen zur Umwandlung von Daten in andere Datentypen zur Verfügung.
Inhaltsverzeichnis
Datum, Zeit oder Zahl in String umwandeln
Format( value, expr)
| Argumente | value | Zu formatierendes Datum/Zeit/Zahl | |
|---|---|---|---|
| expr | Struktur des Rückgabewerts | ||
| Rückgabewert | Gibt value entsprechend den Vorgaben in expr formatiert zurück. | ||
| Beispiele | Format(ME.StartTime,'h:m:s') |
"5:4:23" | ME.StartTime ist der 27.01.2020 17:14:23.
|
Format(ME.StartTime,'hh:mm:ss tt') |
"05:04:23 PM" | ||
Format(ME.StartTime,'dddd, MMM d yyyy') |
"Montag, Jan 27 2020" | ||
Format(ME.StartTime,'HH:mm:ss') |
"17:04:23" | ||
Format(5459.4,'##,##0.00') |
"5,459.40" | ||
Format(334.9,'###0.00') |
"334.90" | ||
Format(5,'0.00%') |
"500.00%" | ||
| Hinweis | Entspricht weitgehende der Format()-Funktion in Visual Basic. | ||
String in Zahl umwandeln
FindNumberL( str, count )
| Argumente | str | Quellstring |
|---|---|---|
| count | Integer, Position der Zahl | |
| Rückgabewert | Gibt die count-te Zahl in str zurück. | |
| Beispiele | FindNumberL('Year:2020 Month6 Day1',1) |
2020 |
FindNumberL('Year:2020 Month6 Day1',2) |
6 | |
FindNumberL('Year:2020 Month6 Day1',2) |
1 | |
FindNumberR( str, count )
| Argumente | str | Quellstring |
|---|---|---|
| count | Integer, Position der Zahl | |
| Rückgabewert | Gibt die count-te Zahl von rechts in str zurück. | |
| Beispiele | FindNumberR('Year:2020 Month6 Day1',1) |
1 |
FindNumberR('Year:2020 Month6 Day1',2) |
6 | |
FindNumberR('Year:2020 Month6 Day1',2) |
2020 | |
Datum in Zahl umwandeln
GetYearPart( time )
| Argument | time | Zielzeit |
|---|---|---|
| Rückgabewert | Gibt das Jahr von time zurück. | |
| Beispiel | GetYearPart(#2020/6/1 12:30:00#) |
2020 |
GetMonthPart( time )
| Argument | time | Zielzeit |
|---|---|---|
| Rückgabewert | Gibt den Monat von time zurück. | |
| Beispiel | GetMonthPart(#2020/6/1 12:30:00#) |
6 |
GetDayPart( time )
| Argument | time | Zielzeit |
|---|---|---|
| Rückgabewert | Gibt den Tag von time zurück. | |
| Beispiel | GetDayPart(#2020/6/1 12:30:00#) |
1 |
GetHourPart( time )
| Argument | time | Zielzeit |
|---|---|---|
| Rückgabewert | Gibt die Stunde von time zurück. | |
| Beispiel | GetHourPart(#2020/6/1 12:30:00#) |
12 |
GetMinutePart( time )
| Argument | time | Zielzeit |
|---|---|---|
| Rückgabewert | Gibt die Minute von time zurück. | |
| Beispiel | GetMinutePart(#2020/6/1 12:30:00#) |
0 |
GetSecondPart( time )
| Argument | time | Zielzeit |
|---|---|---|
| Rückgabewert | Gibt die Sekunde von time zurück. | |
| Beispiel | GetSecondPart(#2020/6/1 12:30:00#) |
0 |
Datum in Zeit umwandeln
GetTimePart( time )
| Argument | time | Zielzeit |
|---|---|---|
| Rückgabewert | Gibt die Zeit von time zurück. | |
| Beispiele | GetTimePart(#2020/6/1 12:30:00#) |
12H30M |
GetTimePart(now()) |
Aktuelle Zeit | |
Zeit in Zeit umwandeln
ConvertTime( time, unit )
| Argumente | time | Zielzeit | |
|---|---|---|---|
| unit | Basiseinheit der Umwandlung - Sekunde, Minute, Stunde oder Tag | ||
| Rückgabewert | Gibt time als Zahl zurück. | ||
| Beispiele | ConvertTime(350s,'m') |
5 | 5m + 50s, Sekunden werden abgerundet. |
ConvertTime(350s,'M') |
6 | 5m + 50s, Sekunden werden aufgerundet. | |
ConvertTime(1.6H,'H') |
2 | 1h + 36m, Minuten werden aufgerundet. | |
| Hinweis | Erlaubte Werte für unit sind
| ||
Zahl in Datum umwandeln
DateF( year, month, day, hour, minute, second )
| Argumente | year | Integer, Jahr |
|---|---|---|
| month | Integer, Monat | |
| day | Integer, Tag | |
| hour | Integer, Stunde | |
| minute | Integer, Minute | |
| second | Integer, Sekunde | |
| Rückgabewert | Gibt year, month, day, hour, minute & second als Datum zurück. | |
| Beispiel | DateF(2020,6,15,6,30,30) |
2020/06/15 06:30:30 |
| Hinweis | Das "F" in DateF() steht für "vollständig" ("full"), da alle Elemente des Datums vorgegeben werden können.
| |
DateS( year, month, day )
| Argumente | year | Integer, Jahr |
|---|---|---|
| month | Integer, Monat | |
| day | Integer, Tag | |
| Rückgabewert | Gibt year, month & day als Datum zurück. | |
| Beispiel | DateS(2020,6,15) |
2020/06/15 00:00:00 |
| Hinweise |
| |
DateT( year, month, day, time )
| Argumente | year | Integer, Jahr |
|---|---|---|
| month | Integer, Monat | |
| day | Integer, Tag | |
| time | Integer, Zeitspane | |
| Rückgabewert | Gibt year, month, day & time als Datum zurück. | |
| Beispiele | DateT(2020,6,15,6H) |
2020/06/15 06:00:00 |
DateT(2020,6,15,6M) |
2020/06/15 00:06:00 | |
DateT(2020,6,15,6S) |
2020/06/15 00:00:06 | |
| Hinweise | Das "T" in DateT() steht für "Zeitspanne" ("time span").
| |
Hilfe Nummer: 741520