function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Guys, Any idea on date format cast function for SOQL?

Guys, Any idea on date format cast function for SOQL? similar to convert(varchar,getdate(),106) in sql

Am trying to format the grid in using the output but since the output is returned as string it is difficult for me to format the date based on the culture info. and all my controls are created dynamically in the page which are queried using the partner wsdl. So I desperately need this. can someone help on this pls?




Raumil SetalwadRaumil Setalwad

Hello Friend,


According to uour quey i think you can use following code



<apex:outputText value="The formatted time right now is: 
         {0,date,yyyy.MM.dd G 'at' HH:mm:ss z}">
       <apex:param value="{!NOW()}" />



for formatting date where in <apex:param> will display the value of your formatted parameter which is fetched in controller and displayed in date format in ouput text


Hope this helps



Raumil Setalwad


hey Raumil,


  Thanks for your response.

My requirement is not in Apex.

Actually I am pulling the data thru api from .net (C#) and based on the no of columns available in a particular view

am framing the soql and displaying it in a gridview.

but since the output that comes from sf after querying the data is in string format am not able to set the column types for the gridview as the columns are also dynamically generated in the gridview.

since am unable to format that am getting an output in this format only : 0,date,yyyy.MM.dd G 'at' HH:mm:ss z

but i need to display it based on the user's culture info.

so am expecting something in soql like we have in sql :- a similar format like cast(convert(varchar,getdate(),106) as datetime)