question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Convert Input time to 24hrs in ts file

See original GitHub issue

Everything works fine till now. Here I have requirement(I want display only 12hrs calendar)

  1. If a user select time as 10:30 am then I need to send to my back-end as 10:30:00
  2. As well as if user select time as 10:30 pm then I need to send to my back-end as 22:30:00

I tried like below this.timer.replace(/ /g, '').replace('am', ':00').replace('pm', ':00'). I there any option to do my requirement?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Agranomcommented, May 17, 2019

@KK220794 change small hh to bigger ones HH in toFormat()

1reaction
Ram12393commented, Apr 10, 2019

till now it’s working fine. Thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

convert 24-hour time-of-day string to 12-hour time with AM/PM ...
Nothing built in, my solution would be as follows : function tConvert (time) { // Check correct time format and split into components...
Read more >
how to convert 12 hour time to 24 hour time in javascript Code ...
1. var ts = Math.round(new Date().getTime() / 1000); ; 2. var tsYesterday = ts - (24 * 3600); ; 3. ​.
Read more >
How to validate time in 24-hour format using Regular Expression
Given a string str, the task is to check whether the string is valid time in 24-hour format or not by using Regular...
Read more >
Angular Pipe (or just Javascript) to Convert 24 Time to 12 ...
I'm storing time in my database as 24 hour format (ie: “13:00” [1:00 PM]) because it's easy and has a bunch of advantages....
Read more >
<input type="time"> - HTML: HyperText Markup Language | MDN
The value of the time input is always in 24-hour format that includes leading zeros: hh:mm , regardless of the input format, which...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found