Skip to main content
Best answer

Format time (17:30:00) to number (1730)

  • Mar 16, 2023 11:41 AM UTC
  • 7 replies
  • 160 views

polmarza

The Google Form returns the times in the format "17:30:00" in the Google Sheets answer sheet. So, I need to format this time to "1730" with Zapier.

If it is not possible to do it with "Formatter by Zapier", can it be done with Js (although it is not the desired option)?

How can I do this?

Thanks for your time :)

Best answer by ken.a

Hey @polmarza,

I’m glad the suggestion by SamB worked. That said, looking at the screenshot you sent, the “To Format” field seems picky when converting the time. What you want to do here is to replace the “hh” with “HH” and leave the “From Format” field blank. Here’s what it will look like:

Date / Time in Formatter Setup:

9f7622aeb18a601556f6fdb6e80b8378.png
(view larger)

Date / Time in Formatter Output:

7f0ce29d081d506bf6f0b1f569e8579e.png
(view larger)

Kindly give it a try and let me know how it goes?

View original
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

7 replies

SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • Mar 16, 2023 1:55 PM UTC

Hi @polmarza!

It should be possible to format the column that contains the times directly within Google Sheets.

To do that you’d select the column then go to Format > Number > Custom date and time: 

15d2ef839ae2198b67b5e82fa026270d.png
Then select the relevant options to create the custom format:
24270c59b988be05811f2b0db9f16ed5.png
Which should then display the times in the desired format:
1bb47b74b0e04f99d1e3b39284276a2c.png

Then they should come through to the Zap in the desired format:

d0d8f32d593751bd5658f8d04eb5f0dd.png
Which would save you needing to use a Formatter (Date / Time > Format) action to convert the time into HHmm format.

Want to give that a go and see if that does the trick?

 


polmarza
  • Author
  • Beginner
  • Mar 16, 2023 2:16 PM UTC

Thank you very much! It has worked @SamB 😁


SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • Mar 16, 2023 2:37 PM UTC

Yay! 🎉 Thanks for confirming that worked @polmarza. I’m so glad that sorted it! 😁


polmarza
  • Author
  • Beginner
  • Mar 16, 2023 4:29 PM UTC

Sorry @SamB , it worked for Google Sheets, but when I went to search for the information from zapier, it still read the time in 17:30:00 format:


Then I tried to do it through Zapier. I think it's configured correctly, but the answer I get is not in 24h format... This is what happens when I click on "test":

 

But the result is 0530 instead of 1730. 

Can you think of a solution? 

Thanks a lot Sam


ken.a
Forum|alt.badge.img+6
  • Zapier Staff
  • Answer
  • Mar 17, 2023 12:11 AM UTC

Hey @polmarza,

I’m glad the suggestion by SamB worked. That said, looking at the screenshot you sent, the “To Format” field seems picky when converting the time. What you want to do here is to replace the “hh” with “HH” and leave the “From Format” field blank. Here’s what it will look like:

Date / Time in Formatter Setup:

9f7622aeb18a601556f6fdb6e80b8378.png
(view larger)

Date / Time in Formatter Output:

7f0ce29d081d506bf6f0b1f569e8579e.png
(view larger)

Kindly give it a try and let me know how it goes?


polmarza
  • Author
  • Beginner
  • Mar 17, 2023 9:26 AM UTC

Great! Now it's all worked out :)

Please @ken.a close the thread and mark your answer as correct ^^


SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • Mar 17, 2023 10:23 AM UTC

Thanks for hopping back in here to let us know that solved it, @polmarza. I’m really pleased to see ken.a was able to help you with that Formatter action! 😁

Happy Zapping! ⚡