0

I'm tying to fetch some data from Shopify admin REST API via php.

When I fetch orders data, It includes the date and the time of order initially created as created_at

 "created_at" => "2022-12-16T08:51:48+05:30"

I created a new array from the existing orders array which only includes those created_at key values.

// Store all the gateways to a new array
            $newArr_createdAt = array_column($result_3['orders'] , "created_at");

This gives me the following output

array:8 [▼
  0 => "2022-12-16T08:51:48+05:30"
  1 => "2022-12-14T11:45:59+05:30"
  2 => "2022-12-12T15:52:49+05:30"
  3 => "2022-12-12T09:56:56+05:30"
  4 => "2022-12-12T09:46:03+05:30"
  5 => "2022-12-10T10:45:43+05:30"
  6 => "2022-11-30T09:54:49+05:30"
  7 => "2022-11-30T09:53:25+05:30"
]

Now I want to draw a google bar chart to display the number of orders V time.

But I'm struggling to separate the time from the initial created_at value which is something like,

2022-12-16T08:51:48+05:30

I need just the 08:51:48

and create a new array which only contains the time

array:8 [▼
  0 => "08:51:48"
  1 => "11:45:59"
  2 => "15:52:49"
  3 => "09:56:56"
  4 => "09:46:03"
  5 => "10:45:43"
  6 => "09:54:49"
  7 => "09:53:25"
]
  • the suggested question is not answering to my question, this is not about converting normal date time to another format, this is about an array value... – nikamata hukamuko Dec 18 '22 at 01:57

0 Answers0