I would like to compare two dates.
Problem: The date and time strings are formatted by Globalize. So, I'm not able to split the values the same way and have to differenciate everytime.
I would like to have a function like...
Globalize.getTimestamp("21.12.2012 19:41", "d t") // value, pattern
...but cannot find it.
That's the form:
<label>From</label>
<input type="text" name="start_date" value="21.12.2012" class="datepicker"/>
<input type="text" name="start_time" value="19:41" class="timepicker"/>
<label>To</label>
<input type="text" name="end_date" value="22.12.2012" class="datepicker"/>
<input type="text" name="end_time" value="19:41" class="timepicker"/>
Edit: That's how to parse the date:
Globalize.parseDate($("[name='start_date']").val()); // 21.12.2012
But parsing the date with time doesn't work:
Globalize.parseDate($("[name='start_date']").val() + " " + $("[name='start_time']").val()); // 21.12.2012 19:41
I'd like to avoid developing the Globalize.getTimestamp()-function. How would you solve this problem? Any ideas? Thanks!