Javascript time formatting issue

Programming
Tutor: None Selected Time limit: 3 Days

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

WHAT I WANT
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();
d.getHours() 



But does not recognize this formatting:

<html>
<head>
<title>hello</title>
</head>
<body>
var d = new Date();
d.getHours()
</body>
</html>


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

hi

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



Aug 28th, 2014

Studypool's Notebank makes it easy to buy and sell old notes, study guides, reviews, etc.
Click to visit
The Notebank
...
Nov 30th, -0001
...
Nov 30th, -0001
Dec 6th, 2016
check_circle
Mark as Final Answer
check_circle
Unmark as Final Answer
check_circle
Final Answer

Secure Information

Content will be erased after question is completed.

check_circle
Final Answer