/    Sign up×
Community /Pin to ProfileBookmark

change the format of date object

hey
i need to change the format of inserting the date value into the date object, someone know how can i do this ?
i need to enter this format :

DD/MM/YYYYY hh:mm (beside : MM/DD/YYYY hh:mm)
i was try this :
date=new Date(“30/10/2007 11:11”);
but its not working…
thanks !

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@mjdamatoSep 22.2007 — Instead of changing the way date() accepts input, you need to chnage your input:

<i>
</i>dateStr = '30/10/2007 11:11';
dateAry = dateStr.split('/');
dateStr = dateAry[1]+'/'+dateAry[0]+'/'+dateAry[2];
//dateStr is now '10/30/2007 11:11'
date=new Date(dateStr);
Copy linkTweet thisAlerts:
@KorSep 23.2007 — The general arguments for a Date() object are:

[B]Date([/B][I]yyyy,mm[COLOR="Red"][[/COLOR],dd,hh,mm,ss,ms[COLOR="Red"]][/COLOR][/I][B])[/B]

that means: Year,Month (0=January),Date,Hours,Minutes,Seconds,Milliseconds. Don't [I]use[/I] the red square brackets, I use them only to point out here the fact that the square bracketed values are optional. If no value, 0 (or 1 in case of date) is their default.

If no arguments at all, the new Date() object will return the precise date when the method is called (the [I]"now"[/I] moment)
×

Success!

Help @mystic-d 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 5.28,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...