Eugene Eugene - 7 months ago 36
C# Question

WooComerce Data. C#

I recieving data from woocomerce.

Receiving it like this.

RestAPI rest = new RestAPI("", "ck_9d64c027d2c5f81b8bed3342eeccc6d337be813d", "cs_60697b1e6cbdeb8d62d19e0765e339f8e3334754");

WCObject wc = new WCObject(rest);
//Get all products
var orders = await wc.GetOrders();

foreach (var order in orders) {

Debug.WriteLine($"Currency: {order.currency},Date:{order.date_created},Adress: {order.billing}, Total Cost: {}");


In this part all okay. But I have received Date and Time in wrong format.

Date:8/18/2016 8:33:12 AM

On website is not UTC , on website UTC+2

Can I convert it to UTC+2 , 24 hours format?


Use DateTime.Parse with the appropriate format then call ToString() with the format you want it in. So If you know you're getting +2:00 you can do:

string date = order.date_created + "+2:00";
DateTime dt = DateTime.Parse(date);
string convertedDate = dt.ToString("MM/dd/yyyy HH:mm:ss");