function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Pankaj PariharPankaj Parihar 

sapreat date from createdby

User-added image
hi friends 
i wanted to acess date and time  separately how can i get it
through batch code
Hi Pankaj.
trye like below :

String sDate = String.valueOf( ;
String sTime= String.valueOf(obj.createdDate.time() ;

 here is the sample code :
List<account> acc = [select id, createdDate from account LIMIT 1];


i hope it helps you.
      Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
v varaprasadv varaprasad
Hi Pankaj,

Please check once below sample code it may help you.
list<account> acccs = [SELECT Id,createddate,createdbyid
                       FROM account limit 10];

Map<date,Long> mapDat = new Map<date,Long>();

for(account acc : acccs){
    DateTime dt = acc.createddate;
    Date myDate =;
    Long gettime = dt.getTime();

Hope this helps you.

Pankaj PariharPankaj Parihar
hi piush
can u help me in this batch program same createdby date related
Assign all the leads created during non-business hours to specified queue and leads created during business hours to specified queue.
Hi pankaj, please put a new query on forum regarding to your new requrement in proper details, so everyone can take a look into this, and close your this query by choosing best answer so it will make proper solution for others in future.
Ramakrishna Reddy GouniRamakrishna Reddy Gouni
[select Id, createdById, createdBy.Name, createdDate from Contact];
[select Id, createdById, createdBy.Name, createdDate from Account];
[select Id, createdById, createdBy.Name, createdDate from Opportunity];
i tried few object, all are working