Id it possible to do something like:

```
var format = "ampm";
var time = '22:15:05';

if(format == "ampm") {
   return '10:15 pm';
} else {
   return '22:15';
}

```

All the examples that I found use new Date() with current date and time, but in my case i just need to pass time string from database.