How to use date_make_date() in drupal 7? I am porting custom module from drupal 6 to drupal 7 
I have the following code:

 $local_date = new DateTime($dateTxt);
 $iso_date_string = date_format_date($local_date, 'custom', 'Y-m-d\TH:i:s');
 $utc_date = date_make_date($iso_date_string, $user_timezone_name, DATE_DATETIME);


What can be the alternative for date_make_time() in drupal 7?

https://www.drupal.org/node/1075476


  this error is due to a change in the Date API module, instead of
  date_make_date you need to use the new DateObject class. see "D7
  Changes" here: http://drupal.org/project/date
  
  I fixed this as follows, but not sure if I'm using the DateObject
  properly.
  
  Edit this block of code in agenda.module, line 354


  // If the Date API is installed, we can do better at DST times   if (module_exists('date_api')) {
    $start               = date_make_date($event['start timestamp'], NULL, DATE_UNIX);
    $event['start time'] = date_format_date($start, 'custom', $block-&gt;timeformat);
    $end                 = date_make_date($event['end timestamp'], NULL, DATE_UNIX);
    $event['end time']   = date_format_date($end, 'custom', $block-&gt;timeformat);   } 


replace with

  // If the Date API is installed, we can do better at DST times   if (module_exists('date_api')) {
    $start               = new DateObject($event['start timestamp'], NULL);
    $event['start time'] = $start-&gt;format($block-&gt;timeformat);
    $end                 = new DateObject($event['end timestamp'], NULL);
    $event['end time']   = $end-&gt;format($block-&gt;timeformat);   } alternatively, just comment out the whole block.


I looked in the above node but not sure about the new DateObject() ?

new DateObject()
The alternative to the date_make_date function in D7 is the DateObject, which extends the PHP DateTime class.

To make your code work properly, you'd do something like this (untested): 

$local_date = new DateTime($dateTxt, $timezone); //$timezone can be string or object
$iso_date_string = $local_date-&gt;toIso(); //returns the ISO string for the date
$utc_date = clone $local_date; //don't want pass by reference
$utc_date-&gt;setTimezone(new DateTimeZone('UTC')); //set the new timezone to return
$utc_date_iso = $utc_date-&gt;toIso(); //returns $local_date converted to UTC as an ISO string.


I'm not totally sure what you want to do, but this, hopefully, will get you on the right path.