# How do i get local time?

**URL:** <https://forum.legato.io/t/how-do-i-get-local-time/5437>\
**Category:** Legato Application Framework\
**Created:** [October 5, 2020, 3:23pm UTC](https://forum.legato.io/t/how-do-i-get-local-time/5437 "2020-10-05T15:23:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![skHemel](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/skhemel/32/1088_2.png) [@skHemel](https://forum.legato.io/u/skHemel)\
**Post date:** [October 5, 2020, 3:23pm UTC](https://forum.legato.io/t/how-do-i-get-local-time/5437/1 "2020-10-05T15:23:22Z")

</div>

I have been using le\_pos\_GetTime(&hours, &minutes, &seconds, &milliseconds); to get time. But the output time it is providing is in UTC +0. My time zone is UTC-4. How can I get my current local time?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [October 5, 2020, 3:40pm UTC](https://forum.legato.io/t/how-do-i-get-local-time/5437/2 "2020-10-05T15:40:28Z")

</div>

You can type “date” to get local time.

Also you can have a look on this api

> **[None - Legato Docs](https://docs.legato.io/latest/le __rtc__ interface_8h.html#a1819b745bbef6d340305ce07b9b7ce2f)**
>
> legato™ is an open source Linux-based embedded platform designed to simplify connected IoT application development

---

<div class="post-metadata">

**Author:** ![skHemel](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/skhemel/32/1088_2.png) [@skHemel](https://forum.legato.io/u/skHemel)\
**Post date:** [October 5, 2020, 4:39pm UTC](https://forum.legato.io/t/how-do-i-get-local-time/5437/3 "2020-10-05T16:39:06Z")

</div>

RTC is still giving UTC +0. Is there any way to set it to EST?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [October 5, 2020, 11:00pm UTC](https://forum.legato.io/t/how-do-i-get-local-time/5437/4 "2020-10-05T23:00:37Z")

</div>

Does this help?

> **[Set Linux System Date & Time on mangOH Yellow](https://forum.mangoh.io/t/set-linux-system-date-time-on-mangoh-yellow/2965/6)**
>
> Not at the unit at the moment. I had seen the busybox docs, the format I tried from there didn’t wasn’t accepted when I tried it. The date format @pinst suggested worked, but I don’t think I got the time - the mangOH seems to be working with an...

He suggests a link:

> **[How To: 2 Methods To Change TimeZone in Linux](https://www.thegeekstuff.com/2010/09/change-timezone-in-linux/)**
>
> Question: When I installed the Linux OS, I forgot to set the proper timezone. How do I change the timezone on my Linux distribution. I use CentOS (Red Hat Linux). But, can you please explain me how to do this on all Linux distributions with some...

---

<div class="post-metadata">

**Author:** ![skHemel](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/skhemel/32/1088_2.png) [@skHemel](https://forum.legato.io/u/skHemel)\
**Post date:** [October 6, 2020, 6:02am UTC](https://forum.legato.io/t/how-do-i-get-local-time/5437/5 "2020-10-06T06:02:49Z")

</div>

Here is an update:  
I followed this documentation: [https://docs.legato.io/15\_10/tools\_host\_settz.html](https://docs.legato.io/15_10/tools_host_settz.html)

After that I tried “date” which which showed local time but still the functions I am using in my code are giving UTC +0 time;

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [October 6, 2020, 6:14am UTC](https://forum.legato.io/t/how-do-i-get-local-time/5437/6 "2020-10-06T06:14:59Z")

</div>

then why don’t use the “date” related API in your code?
