use here set type method:
add_action('init','engineCreateRecurringSchedule');
add_action('engineRecurringCronJob','engineDaysToGoUpdate');
function engineDaysToGoUpdate(){
// Arguments to get published posts with 'engine' post type.
$engineDaysToGoArgs = get_posts( array (
'post_status' => 'publish'
'posts_per_page' => -1,
'post_type' => 'engine') );
// Calling the value of custom field.
$engineDaysToGo = genesis_get_custom_field('wpcf-engine-days-to-go');
settype($engineDaysToGo, "integer");
// Subtracting 1 from the value.
$updatedEngineDaysToGo = $engineDaysToGo--;
// Updating the value of the custom field.
for each ($engineDaysToGoArgs as $key => $value) {
// Inserting the updated value of the custom field.
$update_post_meta($engineDaysToGoArgs, $engineDaysToGo, $updatedEngineDaysToGo,);
}}
function engineCreateRecurringSchedule(){
// Check to see if event is scheduled before.
if(!wp_next_scheduled('engineRecurringCronJob'))
//Schedule to run at midnight every night.
wp_schedule_event (time(), 'daily', 'engineRecurringCronJob');
}