I have the option of using either JavaScript or c# to accomplish this task.
I have a lot of strings in the format "10/14/2012 8:45:34 PM" How do I remove the seconds and retain the PM like so "10/14/2012 8:45PM"?
I can't use substring because the length of the string will be different with each day and time.
In C#, you can do this:
myTime.ToString("MM/dd/yyyy hh:mmtt");
Alternatively, you can use the built in Format Specifiers described here.
Edit - I removed the space between mm and tt because I just noticed your post shows 8:45PM. You can add a space between mm and tt if you want it to be 8:45 PM.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With