Changeset 43 in code for trunk/lib/date.ml


Ignore:
Timestamp:
Dec 18, 2022, 2:49:25 PM (2 years ago)
Author:
fox
Message:

Relation dates, with conversion condition upon it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/date.ml

    r5 r43  
    1616        Scanf.sscanf date "%4d-%02d-%02dT%02d:%02d:%02d"
    1717                (fun y mo d h mi s -> (y-1970)*31557600 + mo*2629800 + d*86400 + h*3600 + mi*60 + s)
     18let of_secs s =
     19        let { Unix.tm_sec=seconds; tm_min=minutes; tm_hour=hours;
     20                tm_mday=day; tm_mon=month; tm_year=year; _ } = Unix.localtime (float_of_int s) in
     21                Printf.sprintf "%4d-%02d-%02dT%02d:%02d:%02d"
     22                        (year+1900) (month+1) day hours minutes seconds
Note: See TracChangeset for help on using the changeset viewer.