# How to extract time from a date value?

**URL:** <https://community.glideapps.com/t/how-to-extract-time-from-a-date-value/30167>\
**Category:** Ask for Help\
**Created:** [August 8, 2021, 8:14am UTC](https://community.glideapps.com/t/how-to-extract-time-from-a-date-value/30167 "2021-08-08T08:14:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Turrell](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mark_turrell/32/26605_2.png) [@Mark\_Turrell](https://community.glideapps.com/u/Mark_Turrell)\
**Post date:** [August 8, 2021, 8:14am UTC](https://community.glideapps.com/t/how-to-extract-time-from-a-date-value/30167/1 "2021-08-08T08:14:28Z")

</div>

I’m a bit stuck!

I have two time values (in Google Sheets they appear as time, 07:00, plus they can be a value (0.x)

- this is opening and closing hours in utc

I have a computed column in my lookup sheet that uses XC for getting UTC - as a date time value (date + time)

I’m stuck on doing my if-then-else on just the time part of the utc / now.

Any help, please? Thanks!

---

<div class="post-metadata">

**Author:** ![Mark\_Turrell](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mark_turrell/32/26605_2.png) [@Mark\_Turrell](https://community.glideapps.com/u/Mark_Turrell)\
**Post date:** [August 8, 2021, 8:31am UTC](https://community.glideapps.com/t/how-to-extract-time-from-a-date-value/30167/2 "2021-08-08T08:31:12Z")

</div>

I got it fixed… by remembering that a time value alone in Glide is computed as today’s date + time. So I did actually have the right values - as long as I used a math column for the time.

---

<div class="post-metadata">

**Author:** ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)\
**Post date:** [August 8, 2021, 8:55am UTC](https://community.glideapps.com/t/how-to-extract-time-from-a-date-value/30167/4 "2021-08-08T08:55:54Z")

</div>

I made a script on the same principle as DateUTC but with only the time.  
Only, it is necessarily a string value in return.

for YC  
[https://TimeUTC.manun2.repl.co](https://TimeUTC.manun2.repl.co)

Source

> **[TimeUTC](https://replit.com/@ManuN2/TimeUTC?v=1)**
>
> Public

---

<div class="post-metadata">

**Author:** ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)\
**Post date:** [August 8, 2021, 9:03am UTC](https://community.glideapps.com/t/how-to-extract-time-from-a-date-value/30167/5 "2021-08-08T09:03:27Z")

</div>

But if you have a date & time you can use a Math column and only display the time !!!

---

<div class="post-metadata">

**Author:** ![Mark\_Turrell](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mark_turrell/32/26605_2.png) [@Mark\_Turrell](https://community.glideapps.com/u/Mark_Turrell)\
**Post date:** [August 8, 2021, 9:41am UTC](https://community.glideapps.com/t/how-to-extract-time-from-a-date-value/30167/6 "2021-08-08T09:41:06Z")

</div>

The issue was not displaying, but handing the datetime values with just the decimal place value for the time itself.

---

<div class="post-metadata">

**Author:** ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)\
**Post date:** [August 8, 2021, 3:43pm UTC](https://community.glideapps.com/t/how-to-extract-time-from-a-date-value/30167/7 "2021-08-08T15:43:30Z")

</div>

What is the decimal value of a date?  
an example !!

---

<div class="post-metadata">

**Author:** ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)\
**Post date:** [August 8, 2021, 4:09pm UTC](https://community.glideapps.com/t/how-to-extract-time-from-a-date-value/30167/8 "2021-08-08T16:09:46Z")

</div>

**But this also exists with a Math column**  
use x-trunc (x)

After if you want the decimal part of a number you can use

return p1- parseInt (p1)

example if P1 = 10.95  
return 0.95

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/0/b07b0f304387ae9600ed7466d9be182d5ae854d0.png)

---

<div class="post-metadata">

**Author:** ![Mark\_Turrell](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mark_turrell/32/26605_2.png) [@Mark\_Turrell](https://community.glideapps.com/u/Mark_Turrell)\
**Post date:** [August 8, 2021, 5:26pm UTC](https://community.glideapps.com/t/how-to-extract-time-from-a-date-value/30167/9 "2021-08-08T17:26:47Z")

</div>

Date time values are integers for the days, and decimal place for the time (ie 1200 midday is 0.5).
