• Hi,

    how do I fix an issue whereby the date timestamp that is getting printed on the docket is incorrect (i.e. one day ahead). The date timestamp for the order on the website and admin dashboard is correct – it’s only printing incorrectly?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor lawrenceowen

    (@lawrenceowen)

    @angela2601

    It is unusual for the time to be a full day out. Which time zone are you in? and if you know, what timezone is your server hardware on (most will not know this, usually it should be set to UTC).

    Our ticket can have the date printed in a few locations, in the header it prints both the time of the order, and the time of printing. Is it one or both of these that is incorrect?

    It is also possible that time/data is being added to your receipt by an external plugin adding metadata to the order (i.e. such as a delivery/pickup scheduling plugin). In this case, we just print the text value that is provided by that plugin, and it is therefore somewhat out of our control. To solve it would need some site specific customisation of the plugin. If you could start by helping us to identify which dates are wrong I can hopefully help to fix it it the right way.

    Thread Starter Angela2601

    (@angela2601)

    Hi Lawrence, I’m on AEST timezone. I can’t see the timezone the server hardware is on but I’m assuming it would be UTC. The date and time are showing incorrect in the header of the receipt. I placed a test order at approximately 4.37pm AEST on Saturday the 14th of August and the date time that was printed on the ticket was August 15, 3.37am. I should also mention that it’s the sub header section that is being printed. I commented out the printer header info.

    // Print sub-header
    		$o_num = "Order #".$order_number; // Order number text to print
    		$p_time = date("{$date_format} {$time_format}", current_time('timestamp')); // TIme of printing text
    		$sub_header = star_cloudprnt_get_column_separated_data(array($o_num, $p_time), $selectedPrinter['columns']);
    		if(!empty($sub_header)) {
    			$printer->add_text_line($sub_header);
    		} else {
    			$pw($p_time);
    			$pw($o_num);
    		}
    
    		// Print header info area
    		
    		// MODIFICATIONS START
    		/*
    		$printer->add_new_line(1);
    		$pw("Order Status: ".$order->get_status());
    		$order_date = date("{$date_format} {$time_format}", $order->get_date_created()->getOffsetTimestamp());
    		$pw("Order Date: {$order_date}");	
    
    		$printer->add_new_line(1);
    		if (isset($shipping_items['name']))
    		{
    			$pw("Shipping Method: ".$shipping_items['name']);
    		}
    		$pw("Payment Method: ".$order_meta['_payment_method_title'][0]);
    		
    		*/
    		
    		// MODIFICATIONS END

    I checked the delivery plugin I am using and the timezone has been correctly set (that’s assuming their settings are also applied correctly).

    Thread Starter Angela2601

    (@angela2601)

    What if I edited the sub header to print the order date and time instead of the print date and time? It doesn’t necessarily resolve the issue of it printing the incorrect date and time as the print time but at least it should still print the correct order date and time?

    Thread Starter Angela2601

    (@angela2601)

    I edited the sub header to printer the order date and time instead of the print date and time but it didn’t resolve the issue – it still ended up printing a date time that was about 11-12hrs ahead.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    @angela2601 Please do not create duplicate topics. I have archived your new one and you can continue here.

    Thread Starter Angela2601

    (@angela2601)

    Hi Lawrence, can you please let me know if you know of any workarounds/solutions to this ticket?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Date Timestamp’ is closed to new replies.