/    Sign up×
Community /Pin to ProfileBookmark

help with Date/Time

I’m accessing data from various web pages which use different time formats depending on the country they’re in. For example:

the CA site displays 13-Mar-07 11:26:42 EDT
the UK site displays 13-Mar-07 16:00:00 GMT
the AU site displays 13-Mar-07 02:46:35 AEDST
the US site displays Mar-13-07 08:46:35 PDT
and finally the SG site displays Mar 13, 2007 02:00:02 SGT
note these pages were accessed at different times and aren’t conversions.

I think there’s another site that displays something like 12.03.07 02:00:00 or something, too.
I’m just wondering if there’s an easy way to convert these times to date objects? the method only needs to work in Internet Explorer 7+.

Any help would be great!

Thanks,

Jim

ps sorry about double posting in the other thread, not too sure how to delete a post once you’ve submitted it.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@mrhooMar 12.2007 — All the strings you showed are returned from javascript Date methods,

and so can be passed to a Date constructor as is-

var D=new Date(stringfromDateObject)
Copy linkTweet thisAlerts:
@rokujouauthorMar 12.2007 — I tried this, it didn't work. I get the error 'NaN'.

I thought there may be some kind of regular expression I could use for filtering out each part of the date and setting it using the date methods. Any more help would be greatly appreciated.

Thanks in advance,

Andy
×

Success!

Help @rokujou 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.18,
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,
)...