Skip to main content

Use javascriptJavaScript functions in VFon a Visualforce page

I am using a DateTime field on a VFVisualforce page which gets its value from the controller. I would like to know if I can use a javascriptJavaScript or jqueryjQuery code directly on VFthe Visualforce page to convert this DateTime Field (DT) to a date field on page load.

I know the javascriptJavaScript function is DT.format('MMMM d, yyyy'), but I need some idea on how to implement this.

My###My Page:

    <apex:page controller="dateTime_custom">
    {!date}
</apex:page>

Controller:###Controller

public class dateTime_custom {
    public datetime getdate(){
        return DateTime.Now();
    }
}

Use javascript functions in VF page

I am using a DateTime field on a VF page which gets its value from controller. I would like to know if I can use a javascript or jquery directly on VF page to convert this DateTime Field (DT) to a date field on page load.

I know the javascript function is DT.format('MMMM d, yyyy') but need some idea on how to implement this.

My Page:

    <apex:page controller="dateTime_custom">
{!date}
</apex:page>

Controller:

public class dateTime_custom {
    public datetime getdate(){
        return DateTime.Now();
    }
}

Use JavaScript functions on a Visualforce page

I am using a DateTime field on a Visualforce page which gets its value from the controller. I would like to know if I can use JavaScript or jQuery code directly on the Visualforce page to convert this DateTime Field (DT) to a date field on page load.

I know the JavaScript function is DT.format('MMMM d, yyyy'), but I need some idea on how to implement this.

###My Page

<apex:page controller="dateTime_custom">
    {!date}
</apex:page>

###Controller

public class dateTime_custom {
    public datetime getdate(){
        return DateTime.Now();
    }
}
Source Link
sf_user
  • 2.3k
  • 7
  • 35
  • 57

Use javascript functions in VF page

I am using a DateTime field on a VF page which gets its value from controller. I would like to know if I can use a javascript or jquery directly on VF page to convert this DateTime Field (DT) to a date field on page load.

I know the javascript function is DT.format('MMMM d, yyyy') but need some idea on how to implement this.

My Page:

    <apex:page controller="dateTime_custom">
{!date}
</apex:page>

Controller:

public class dateTime_custom {
    public datetime getdate(){
        return DateTime.Now();
    }
}