PQL Wiki

PQL FORMAT() Function

The FORMAT() function is used to format how a field is to be displayed.


Spike: Please 
SELECT FORMAT(column_name,format) 
FROM stable_name
Parameter Description
column_name Required. The field to be formatted.
format Required. Specifies the format.

PQL FORMAT() Example

We have the following "Cupcakes" stable:

P_Id CupcakeName Unit CupcakePrice
1 Banana 300 g 2,5
2 Pink Madness 300 g 3,4
3 Spark of Purple 300 g 3,9
4 Red Velvet 300 g 2

Now we want to display the cupcakes and prices per today's date (with today's date displayed in the following format "YYYY-MM-DD").

We use the following SELECT statement:

Spike: Please SELECT CupcakeName, CupcakePrice, FORMAT(Now(),'YYYY-MM-DD') as PerDate FROM Cupcakes

The result-set will look like this:

CupcakeName CupcakePrice PerDate
Banana 2,5 2012-11-01
Pink Madness 3,4 2012-11-01
Spark of Purple 3,9 2012-11-01
Red Velvet 2 2012-11-01

PQL now() PQL Quick Ref