Date format yyyy-MM-dd\'T\'HH:mm:ss.SSSZ

below is my code n I am getting date formatting issue. I am gettin DEBUG|*reqDate*2016-07-29 00:00:00 but i want it in 2016-07-29T08:00:04.000+0000 format. How can i do it

Decimal noOfDays;         String convDate;         CS_Custom_Settings__c cs = CS_Custom_Settings__c.getOrgDefaults();         if(cs != null && cs.Number_of_days_Purge_Batch_Job__c != null){             noOfDays = cs.Number_of_days_Purge_Batch_Job__c;         }         Date reqDate = Date.today() - Integer.valueOf(noOfDays);         System.debug('*reqDate*'+reqDate);         for(Purge_Batch_Job__c batchJob : Purge_Batch_Job__c.getAll().values()){             objAPINames.add(batchJob.Object_API_Name__c);            }         for(String objName : objAPINames){             //System.debug('Query : ' + 'Select Id from ' + objName + ' where CreatedDate <= ' + reqDate);             System.debug('Query : ' + 'Select Id from ' + objName + ' where CreatedDate <=: reqDate');             for(sObject s : Database.Query('Select Id from ' + objName + ' where CreatedDate <=: reqDate')){                  recordIds.add((Id)s.Id);             } 

Replay

Category: apex Time: 2016-07-29 Views: 1
Tags: datetime apex

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.138 (s). 12 q(s)