You need to sign in to do that
Don't have an account?
Sandy Gali
Getting hour from a datetime field
Hi,
I am trying to retrieve hour from a datetime field. I am running a SOQL query and retrieving a set of values in my apex class and looping through them in my visualforce something like
<apex:repeat var="arr" value="{!arrivals}">
{!arr.Pickup_Time__c}' where arrivals is my soql querry in apex which retrieves a set of values.
Pickup_Time__c is a datetime field and I want to get only hour out of it.
I dont want to use formula fields as they are other issues of DST, timezone etc.
Can any help me with this.
Thanks
Thanks for the response. I acutally want to use the hour value for comparision.
Say for ex: if hour value is in between 12 to 20 hours, do something.
I would suggest you, to create a wrapper class and using List<WrapperObject> to iterate rather than directly using the List<records> from your SOQL query.
Wrapper class would be something like this :
Please help the community by marking the answer as "Best Answer" right below the comment, it would help if some faces similar problem.