• sesha
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi 

have used the Below code to get the conversion from GMT TO AEST( Australian Eastern Standard Time),any ideas on using the below code for conversion from GMT TO IST/any alternatives?

We know that IST is + 5 and 1/2 Hours before GMT,Whearas AEST is + 10 hours, so the 1/2 hour is the problem.

Code for conversion of GMT to AEST(Courtesy Steve Lamb),Field Type: Formula,Return Type : Text

if(ISNULL(CreatedDate ), "", Text(CASE(VALUE(MID(TEXT(  CreatedDate ) , 12, 2)) , 0, 10, 1, 11, 2, 12,3, 1,4, 2,5, 3,6, 4,7, 5,8, 6,9, 7,10, 8,11, 9,12,10,13,11,14,12,15, 1,16, 2,17, 3,18,4,19,5,20,6,21, 7,22,8,23,9,24)) & ":" & MID(TEXT( CreatedDate ) , 15, 2) & IF(AND(VALUE(MID(TEXT( CreatedDate ) , 12, 2)) >= 14, VALUE(MID(TEXT( CreatedDate  ) , 12, 2)) <= 1), " AM", " PM"))


regards
Seshagiri Rao

 

  • April 09, 2012
  • Like
  • 0
I am new to Lightning and I am completing Lightning Components Developer Guide. Here, in client-side controller, there is a method 'setCallBack()' used to call the method in server-side controller. I Googled for the detailed explanation of this method but could not find anything. Can anyone explain the all possible parameters of the method and other usages. Here is a sample code from Developer Guide.
({
    "echo" : function(cmp) {
        // create a one-time use instance of the serverEcho action
        // in the server-side controller
        var action = cmp.get("c.serverEcho");
        action.setParams({ firstName : cmp.get("v.firstName") });

        // Create a callback that is executed after 
        // the server-side action returns
        action.setCallback(this, function(response) {
            var state = response.getState();
            // This callback doesn’t reference cmp. If it did,
            // you should run an isValid() check
            //if (cmp.isValid() && state === "SUCCESS") {
            if (state === "SUCCESS") {
                // Alert the user with the value returned 
                // from the server
                alert("From server: " + response.getReturnValue());

                // You would typically fire a event here to trigger 
                // client-side notification that the server-side 
                // action is complete
            }
            //else if (cmp.isValid() && state === "INCOMPLETE") {
            else if (state === "INCOMPLETE") {
                // do something
            }
            //else if (cmp.isValid() && state === "ERROR") {
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                 errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
            }
        });

        // optionally set storable, abortable, background flag here

        // A client-side action could cause multiple events, 
        // which could trigger other events and 
        // other server-side action calls.
        // $A.enqueueAction adds the server-side action to the queue.
        $A.enqueueAction(action);
    }
})

 
Hi 

have used the Below code to get the conversion from GMT TO AEST( Australian Eastern Standard Time),any ideas on using the below code for conversion from GMT TO IST/any alternatives?

We know that IST is + 5 and 1/2 Hours before GMT,Whearas AEST is + 10 hours, so the 1/2 hour is the problem.

Code for conversion of GMT to AEST(Courtesy Steve Lamb),Field Type: Formula,Return Type : Text

if(ISNULL(CreatedDate ), "", Text(CASE(VALUE(MID(TEXT(  CreatedDate ) , 12, 2)) , 0, 10, 1, 11, 2, 12,3, 1,4, 2,5, 3,6, 4,7, 5,8, 6,9, 7,10, 8,11, 9,12,10,13,11,14,12,15, 1,16, 2,17, 3,18,4,19,5,20,6,21, 7,22,8,23,9,24)) & ":" & MID(TEXT( CreatedDate ) , 15, 2) & IF(AND(VALUE(MID(TEXT( CreatedDate ) , 12, 2)) >= 14, VALUE(MID(TEXT( CreatedDate  ) , 12, 2)) <= 1), " AM", " PM"))


regards
Seshagiri Rao

 

  • April 09, 2012
  • Like
  • 0