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
Priya MishraPriya Mishra 

visualforce datetime

Hi All,

i have  to display the day with the date formate in vf page. below is the formate which i am using.

timeStrDt = evStartDateTime.format('MMMMM dd, yyyy',userTimeZone);

but is displaying like March 06, 2019 at 11:33:00 PM IST .
but i want the Wed March 06, 2019 at 11:33:00 PM IST

how we can do this.

Thanks in advance
Santosh Reddy MaddhuriSantosh Reddy Maddhuri
Hi Priya,

here is the code snippet from the below link to achieve what you looking for.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_datetime.htm

code snippet
DateTime myDateTime = DateTime.newInstance(1993, 6, 6, 3, 3, 3);
String formatted = myDateTime.formatGMT('EEE, MMM d yyyy HH:mm:ss');
String expected = 'Sun, Jun 6 1993 10:03:03';
System.assertEquals(expected, formatted);


Hope this Helps.Mark it as best answer if it works. so others can benefit.

Regards,

Santosh.

Raj VakatiRaj Vakati
You can able to do it  as shown below using the format 
 
<apex:outputText value="{0, date, MMMM d',' yyyy hh:mm a}" label="Last Updated:" >
                    <apex:param value="{!updatedAt + offset}" /> 
                </apex:outputText>

 
Priya MishraPriya Mishra
thanks for the replay but i could not ge tthe result like: Wed March 06, 2019 at 11:33:00 PM IST 
Is there any other way to do that.
Santosh Reddy MaddhuriSantosh Reddy Maddhuri

Hi Priya,

Here is the code snippet you looking for.

 

DateTime myDateTime = system.now();
String formatted = myDateTime.format('EEE MMMM d, yyyy \'at\' hh:mm:ss a z');
System.debug('FORMATTED DATE - : '+formatted);

|DEBUG| FORMATTED DATE - : Tue March 12, 2019 at 01:29:53 PM EDT
 




Hope this helps!

Regards,

Santosh.