Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
53
rated 0 times [  60] [ 7]  / answers: 1 / hits: 17164  / 12 Years ago, sat, june 16, 2012, 12:00:00

I'm using jQuery UI datepicker with time plugin. This is how I display time on the page in datepicker itself:



21.06.2012 08:00


I'd like to convert this time to UNIX timestamp before sending to backend. How can I do this?
I don't need to dispay UNIX time on the page, I only need to convert before posting. I've tried:



var d = Date.parse(value_of_datepicker);


but had no luck. It seems date should be formated in another way. Also I've tried several build-in datepicker functions, but all of them set date display view. Thanks.


More From » jquery-ui

 Answers
9

If you use jQuery timepicker by Trent Richardson, you can do this: $(#your_datepicker).datetimepicker(getDate).getTime() / 1000



http://jsfiddle.net/d6Tky/



Remember that this function may return null if no date has been selected.


[#84866] Thursday, June 14, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kalynn

Total Points: 309
Total Questions: 105
Total Answers: 90

Location: Azerbaijan
Member since Fri, May 12, 2023
1 Year ago
;