I have this variable which has for example "12:12:12"
How can I format this into "12:12" only?
I have this variable which has for example "12:12:12"
How can I format this into "12:12" only?
If You have Date Object you can do :
Code:
dateFormat(new Date(), "mm/dd/yy, h:MM:ss TT");
Output
"05/30/14, 11:46:03 AM"
Notations :-
mm -> month
dd -> date
yy -> year
h -> hour
MM -> minutes
ss -> seconds
TT -> AM/PM
Note :- If You dont want the current date time Pass the Date time object in place of new Date();
Hope this Helps you