Skip to content

ndr.format.axon.abfTimeToDatetime

  ABFTIMETODATETIME Convert ABF file time fields to Matlab datetime
    dt = abfTimeToDatetime(uFileStartDate, uFileStartTimeMS) converts
    Axon Binary Format (ABF) file time fields to a Matlab datetime.

    Inputs:
        uFileStartDate    - ABF file start date in YYYYMMDD format as a double
        uFileStartTimeMS  - ABF file start time in milliseconds since midnight

    Output:
        dt              - Matlab datetime representing the date and time

    Example:
        dt = abfTimeToDatetime(20240218, 43200000)  % Feb 18, 2024 at 12:00:00

    Notes:
        - uFileStartDate is expected to be a double in YYYYMMDD format where
          the 8th digit is the first digit of the year
        - uFileStartTimeMS represents milliseconds since midnight (0-86,399,999)

    Error Conditions:
        - Throws error if inputs are not numeric
        - Throws error if uFileStartTimeMS is not in valid range
        - Throws error if uFileStartDate is not in valid format