STRINGFunzione TO_ in Amazon QLDB - Database Amazon Quantum Ledger (Amazon) QLDB

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

STRINGFunzione TO_ in Amazon QLDB

Importante

Avviso di fine del supporto: i clienti esistenti potranno utilizzare Amazon QLDB fino alla fine del supporto il 31/07/2025. Per ulteriori dettagli, consulta Migrare un Amazon QLDB Ledger ad Amazon Aurora Postgre. SQL

In AmazonQLDB, usa la TO_STRING funzione per restituire una rappresentazione in formato stringa di un determinato timestamp nel modello di formato specificato.

Sintassi

TO_STRING ( timestamp, 'format' )

Argomenti

timestamp

Il nome di campo o l'espressione del tipo di dati timestamp che la funzione converte in una stringa.

Un valore letterale del timestamp Ion può essere indicato con backticks (). `...` Per dettagli sulla formattazione ed esempi di valori di timestamp, consulta Timestamp nel documento delle specifiche di Amazon Ion.

format

La stringa letterale che specifica il modello di formato del risultato, in termini di parti relative alla data. Per i formati validi, consultare stringhe in formato timestamp.

Tipo restituito

string

Esempi

TO_STRING(`1969-07-20T20:18Z`, 'MMMM d, y') -- "July 20, 1969" TO_STRING(`1969-07-20T20:18Z`, 'MMM d, yyyy') -- "Jul 20, 1969" TO_STRING(`1969-07-20T20:18Z`, 'M-d-yy') -- "7-20-69" TO_STRING(`1969-07-20T20:18Z`, 'MM-d-y') -- "07-20-1969" TO_STRING(`1969-07-20T20:18Z`, 'MMMM d, y h:m a') -- "July 20, 1969 8:18 PM" TO_STRING(`1969-07-20T20:18Z`, 'y-MM-dd''T''H:m:ssX') -- "1969-07-20T20:18:00Z" TO_STRING(`1969-07-20T20:18+08:00Z`, 'y-MM-dd''T''H:m:ssX') -- "1969-07-20T20:18:00Z" TO_STRING(`1969-07-20T20:18+08:00`, 'y-MM-dd''T''H:m:ssXXXX') -- "1969-07-20T20:18:00+0800" TO_STRING(`1969-07-20T20:18+08:00`, 'y-MM-dd''T''H:m:ssXXXXX') -- "1969-07-20T20:18:00+08:00" -- Runnable statements SELECT TO_STRING(`1969-07-20T20:18Z`, 'MMMM d, y') FROM << 0 >> -- "July 20, 1969" SELECT TO_STRING(`1969-07-20T20:18Z`, 'y-MM-dd''T''H:m:ssX') FROM << 0 >> -- "1969-07-20T20:18:00Z"

Funzioni correlate