• sforcedevelopers
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies

Hi,

 

I have a Datetime field in which my datetime is like this in debug:  "0018-09-03 22:12:20" for example

 

I want to check if above time is between 09:00 (that is 9 AM ) and 11:45 (that is 11:45 AM)  or between 13:15( that is 1:15 PM) and 18:00 (that is 6:00 PM)

 

This is my code to get date and time based on timezone

 

String str_LeadCurrTime= DateTime.now().format('MM-dd-yyyy HH:MM:SS','US/Central');    // debug:  

 

12-16-2013 22:12:20

 AS i can't do any comparisons between string ,i converted above string to datetime as stated below:

 

Datetime myDate = datetime.valueOfGMT(str_LeadCurrTime);     //Debug:  0018-09-03 22:12:20

 

Now i want to make time comparison as mentioned above.

 

Any help would be great.

Thanks in advance...

 

 

 

Hi,

 

I am having a string which has time in it. like 9:00 AM 

 

I want a condition which checks if above time is between 9:00 AM to 1 PM

then do something.

 

How can i write that if statement.

 

As it is a String,its not allowing me to do any comparsions,but i cant use datetime or any data type.

So please help me in writing that if condition.Thanks in advance.

Hi..It may sound silly but this is my trigger.I have written a test class for this.It shows all the values in debug log.But still trigger test coverage is 0%

Any help please.

 

I have fedex application installed in my org.when i create a shipment and ship it,it generates a master tracking number.

Due to security issues i created a custom object and a trigger to copy tracking number in to my custom field on custom object.

 

 

 

trigger shippinginfoupdate on zkfedex__Shipment__c (after update) {
    List<customobject__c> shipList =new List<customobject__c>();
    for(zkfedex__Shipment__c zfs :trigger.new){

    customobject__c s1 =new customobject__c();
        if(zfs != null){

            s1.Tracking_Number__c = zfs.zkfedex__MasterTrackingId__c;
            s1.Ship_Date__c       = zfs.zkfedex__ShipDate__c;
            s1.Lead__c = zfs.zkfedex__RecipientLead__c;
            s1.FedexShipment__c =   zfs.id;
            shipList.add(s1);
        }
    }
    insert shipList;
}

 

Thanks in advance!!!

Hi,

 

I am having a string which has time in it. like 9:00 AM 

 

I want a condition which checks if above time is between 9:00 AM to 1 PM

then do something.

 

How can i write that if statement.

 

As it is a String,its not allowing me to do any comparsions,but i cant use datetime or any data type.

So please help me in writing that if condition.Thanks in advance.

Hi..It may sound silly but this is my trigger.I have written a test class for this.It shows all the values in debug log.But still trigger test coverage is 0%

Any help please.

 

I have fedex application installed in my org.when i create a shipment and ship it,it generates a master tracking number.

Due to security issues i created a custom object and a trigger to copy tracking number in to my custom field on custom object.

 

 

 

trigger shippinginfoupdate on zkfedex__Shipment__c (after update) {
    List<customobject__c> shipList =new List<customobject__c>();
    for(zkfedex__Shipment__c zfs :trigger.new){

    customobject__c s1 =new customobject__c();
        if(zfs != null){

            s1.Tracking_Number__c = zfs.zkfedex__MasterTrackingId__c;
            s1.Ship_Date__c       = zfs.zkfedex__ShipDate__c;
            s1.Lead__c = zfs.zkfedex__RecipientLead__c;
            s1.FedexShipment__c =   zfs.id;
            shipList.add(s1);
        }
    }
    insert shipList;
}

 

Thanks in advance!!!