

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à.

# Funzione TO\$1STRING in Amazon QLDB
<a name="ql-functions.to_string"></a>

**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 registro Amazon QLDB su Amazon Aurora PostgreSQL](https://aws.amazon.com/blogs/database/migrate-an-amazon-qldb-ledger-to-amazon-aurora-postgresql/).

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

## Sintassi
<a name="ql-functions.to_string.syntax"></a>

```
TO_STRING ( timestamp, 'format' )
```

## Argomenti
<a name="ql-functions.to_string.arguments"></a>

*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](https://amzn.github.io/ion-docs/docs/spec.html#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](ql-functions.timestamp-format.md).

## Tipo restituito
<a name="ql-functions.to_string.return-type"></a>

`string`

## Esempi
<a name="ql-functions.to_string.examples"></a>

```
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
<a name="ql-functions.to_string.related"></a>
+ [CAST](ql-functions.cast.md)
+ [DATE\$1ADD](ql-functions.date_add.md)
+ [DATE\$1DIFF](ql-functions.date_diff.md)
+ [EXTRACT](ql-functions.extract.md)
+ [TO\$1TIMESTAMP](ql-functions.to_timestamp.md)
+ [UTCNOW](ql-functions.utcnow.md)