langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
13
Task/Date-format/OCaml/date-format-1.ocaml
Normal file
13
Task/Date-format/OCaml/date-format-1.ocaml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# #load "unix.cma";;
|
||||
# open Unix;;
|
||||
|
||||
# let t = time() ;;
|
||||
val t : float = 1219997516.
|
||||
|
||||
# let gmt = gmtime t ;;
|
||||
val gmt : Unix.tm =
|
||||
{tm_sec = 56; tm_min = 11; tm_hour = 8; tm_mday = 29; tm_mon = 7;
|
||||
tm_year = 108; tm_wday = 5; tm_yday = 241; tm_isdst = false}
|
||||
|
||||
# Printf.sprintf "%d-%02d-%02d" (1900 + gmt.tm_year) (1 + gmt.tm_mon) gmt.tm_mday ;;
|
||||
- : string = "2008-08-29"
|
||||
12
Task/Date-format/OCaml/date-format-2.ocaml
Normal file
12
Task/Date-format/OCaml/date-format-2.ocaml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
let months = [| "January"; "February"; "March"; "April"; "May"; "June";
|
||||
"July"; "August"; "September"; "October"; "November"; "December" |]
|
||||
|
||||
let days = [| "Sunday"; "Monday"; "Tuesday"; (* Sunday is 0 *)
|
||||
"Wednesday"; "Thursday"; "Friday"; "Saturday" |]
|
||||
|
||||
# Printf.sprintf "%s, %s %d, %d"
|
||||
days.(gmt.tm_wday)
|
||||
months.(gmt.tm_mon)
|
||||
gmt.tm_mday
|
||||
(1900 + gmt.tm_year) ;;
|
||||
- : string = "Friday, August 29, 2008"
|
||||
Loading…
Add table
Add a link
Reference in a new issue