Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
100
rated 0 times [  105] [ 5]  / answers: 1 / hits: 58284  / 13 Years ago, tue, january 10, 2012, 12:00:00

I have a jQuery script that receives a string in milliseconds inside a parameter, like this:



params.tweetDate='77771564221';


What I need to do is to create a jQuery function that will be able to format this milliseconds string in a USA time, like 10.00 AM or 10.00 PM.



Is there a jQuery function that is able to do this?



Please help.



Thanks


More From » jquery

 Answers
145

There is Date object in pure javascript, no jQuery needed.
http://www.javascriptkit.com/jsref/date.shtml



Example:



var time = new Date(params.tweetDate),
h = time.getHours(), // 0-24 format
m = time.getMinutes();
// next just convert to AM/PM format (check if h > 12)

[#88123] Sunday, January 8, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zaynerogerb

Total Points: 454
Total Questions: 109
Total Answers: 97

Location: Comoros
Member since Tue, Mar 14, 2023
1 Year ago
zaynerogerb questions
;