forked from phstc/jquery-dateFormat
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME
More file actions
50 lines (40 loc) · 1022 Bytes
/
Copy pathREADME
File metadata and controls
50 lines (40 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
http://plugins.jquery.com/project/jquery-dateFormat
The jQuery Date Format plugin enables the formatting and parsing of dates.
Format with css class name
<code>
<span class="shortDateFormat">2009-12-18 10:54:50.546</span>
<span class="longDateFormat">2009-12-18 10:54:50.546</span>
</code>
output
#1 18/12/2009
#2 18/12/2009 10:54:50
Format with javascript
<code>
<script>
$.format.date("2009-12-18 10:54:50.546", "dd/MM/yyyy");
</script>
</code>
input dates formats
#1 2009-12-18 10:54:50.546
#2 Wed Jan 13 10:43:41 CET 2010
date and time patterns
yyyy = year
MM = month
dd = day
hh = hour
mm = minute
ss = second
Examples
<code>
<script>
document.write($.format.date("2009-12-18 10:54:50.546", "Test: dd/MM/yyyy"));
document.write($.format.date("Wed Jan 13 10:43:41 CET 2010", "dd~MM~yyyy"));
</script>
</code>
output
#1 Test: 18/12/2009
#2 18~12~2009
The css class names patterns by default are
shortDateFormat = dd/MM/yyyy
longDateFormat = dd/MM/yyyy hh:mm:ss
You can change the patterns in jquery.dateFormat