Hi everyone,
I am trying to get date and time from a timestamp number and show it in my local time zone. This timestamp is got from a JSON data. Which is the correct way to do that? I was seeing time API but I ended up a little bit confused.
I don’t understand how it’s related to mbed, it sounds like a general c++ question that should be asked on stackoverflow (if it’s not already answered there).
Can you show us the timestamp? And also the expected output, with formatting if any.
Hi, my question was about how to use Time API from mbed in order to get the the date and time from timestamp (ex 1612841919) in my localtimezone or diferent UTC.
thanks for your reply. Finally I implemented the code below and works but still with problems. The output that gives me Mbed when I compiled and run code in LPC1768 is “10/2/21,1:42:57” but when I run the same code in a C++ online compiler is “10/02/21,01:42:57”. In numbers less than 10, strftime is not adding left zero value and I need the second format. Is there a simple way to do that? because in documentation the function with these format options should work. Thanks for your help