How to Conevrt date field with Datetime in Apex

                 


 

                Date dt = date.valueof('date field name');

                    system.debug('dt-'+dt); 

                 // With below code we can converting date to datetime

                    Integer day =dt.day();

                    Integer month = dt.month();

                    Integer year = dt.year();  

                    DateTime datetimecon = DateTime.newInstance(year, month day);

Post a Comment

0 Comments