/    Sign up×
Community /Pin to ProfileBookmark

Lookinig for a JavaScript Date Function?

Ok here’s the full story. I know of the Date() of JavaScript it has limited but usefull abilities.

I have to format a 12hr date string with hr/min in either PM or AM format.

So the user enters a date example 2005/10/1 selects from a drop down an hour 1-12, min 1-60 and selects AM or PM.

Thanks for the help

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@KorOct 05.2005 — just add 12 to the value of hours if the PM is selected (take care that elements' values are strings, so that you must transform them into numbers before performing a math add)
×

Success!

Help @jlopes151 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...