• if( get_option('ywraq_expired_time', 0) != 0 ){
    			$expire_time = time() +  get_option('ywraq_expired_time', 0) * HOUR_IN_SECONDS;
    			$expire_date = apply_filters( 'ywraq_expire_date_format', date('h:i:s', $expire_time ), $expire_time);
    			$attr['_ywcm_request_expire'] = $expire_date;
    		}
    
    		if ( $attr ) {
    			foreach ( $attr as $key => $item ) {
    				$function = 'set' . $key;
    				if ( is_callable( array( $order, $function ) ) ) {
    					$order->$function( $item );
    				} else {
    					$order->update_meta_data( $key, $item );
    				}
    			}
    			$order->save();
    		}
    	}

    please how can i change this from date to time, it is a quote expiring function but it is set to expire in days, but i want to set the expiring time in hours only not days, example i will like every requested qoute to expire in 48hrs, i got this function from yith woocommerce request quote pluign…
    Please help me with this changes please…

    • This topic was modified 6 years, 1 month ago by bcworkz. Reason: code fixed
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Are you using Yith or just borrowing some code from it? The function already uses expiration time as-is. The value saved in option ‘ywraq_expired_time’ (in hours). The date references you see are just what PHP functions for timestamps are called. The code calculates the timestamp from right now to ‘ywraq_expired_time’ hours into the future and saves the result with the current order.

    Timestamps are the actual seconds since UNIX Epoch (midnight 1 Jan 1970)

    Thread Starter pandglobal

    (@pandglobal)

    okay thanks, now i understand

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom date to time change functions’ is closed to new replies.