0 votes
in SoSci Survey (dt.) by s160429 (210 points)
edited by SoSci Survey

Hallo
Könnten Sie mir helfen den Unix Timecode in ein normales Datum und Zeit umzuwandeln?

Aktuell gibt er mit im Ergebnisbericht einen UNIX Timecode heraus mit folgendem Code:

  add(
    time(
    [
      'family' => 'Times',
      'size' => 15,
      'style' => 'b',  // b=bold, i=italic, u=underline, d=linethrough, o=overline
      'color' => '#000000',
      'text-align' => 'center',
    ]
  ),
  ['top' => 285, 'left' => 90]
);

wie kriege ich daraus ein normales Datum z.B.
05.04.2022 16:37

Ich verstehe das im Manual nicht richtig.
https://www.soscisurvey.de/help/doku.php/de:create:functions:convertdatetime?s[]=*unix*

$eingabe = value('time()');
$ausgabe = convertDateTime($eingabe, null, 'd.m.Y H:i');
replace('%datum%', $ausgabe);

er sagt convertdatetime gibt es als funktion nicht.

Beste Grüsse

1 Answer

0 votes
by SoSci Survey (305k points)

Ihr PHP-Code verwendet die Funktion time(), welche den aktuellen Zeitstempel liefert - und alle Parameter ignoriert. Und convertDateTime() ist für Ihren Fall dar nicht nötig. Alles, was Sie brauchen ist:

date('d.m.Y H:i')

Dies können Sie in text() übergeben.

add(
  text(date('d.m.Y H:i'))
);

Oder

$zeit = date('d.m.Y H:i');
add(text($zeit));

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...