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:
Alternatively, you can use the built in
Format Specifiersdescribed here.Edit – I removed the space between
mmandttbecause I just noticed your post shows8:45PM. You can add a space betweenmmandttif you want it to be8:45 PM.