Javascript time formatting issue

label Programming
account_circle Unassigned
schedule 3 Days
account_balance_wallet $5

I am new, please be patient.

Reporting software I am using pulls in a start and end time from a database into two separate columns. (the data in the database is from a multi-field calculated column.) 

In the reporting software (Entrinsik Informer) I want to format the time so that if the start time and end time are both am (or pm), it will shorten the start time to only the hour (no minutes, no :, no AM/PM)

For example:

Before formatting

Start time End time
7:00 AM - 11:00 AM

after formatting

Start Time End Time
7 - 11:00AM

Likewise if both the start and end are pm timer 1:00pm - 3:00pm should look like 1-3:00pm.

If the start time is am and the end time is a pm, then nothing should occur. 7:00am-1:00pm leave it as is.

The reporting software I am using only accepts Javascript.

Also the reporting software only uses the main javascript code, it doesn't need all the header, title, etc that you would normally need for a webpage. for example the software recognizes this: 

//which does what the function i want, but only on the current time not a database stored time value

var d = new Date();

But does not recognize this formatting:

var d = new Date();

I have read through numerous forums, but none show how to change time from 7:00 AM to 7

Any assistance would be greatly appreciated.

Nov 30th, -0001


I think you can use date to string method in javascript.

Aug 28th, 2014

Did you know? You can earn $20 for every friend you invite to Studypool!
Click here to
Refer a Friend
Nov 30th, -0001
Nov 30th, -0001
Oct 24th, 2017
Mark as Final Answer
Unmark as Final Answer
Final Answer

Secure Information

Content will be erased after question is completed.

Final Answer