Usage for dateStringToMJD

Return to directory of Todd's CASA extensions

Convert a date/time string to floating point MJD. Input date format:
  • 2011/10/15 05:00:00 or
  • 2011/10/15-05:00:00 or
  • 2011-10-15 05:00:00 or
  • 2011-10-15-05:00:00 or
  • 2011-10-15T05:00:00 (which is the format output by the ALMA TMC DB tool, located at
  • 2011-Oct-15 05:00:00 (and the other time formats)
The time portion is optional. See also dateStringToMJDSec and strDate2MJD.


au.dateStringToMJD(datestring='2011/10/15 05:00:00', datestring2='', verbose=True, use_metool=True):
  • use_metool: if True, use the casa measures tool; otherwise use a canned formula to convert to MJD.
  • verbose: set to True for debugging messages


CASA <4>: au.dateStringToMJD('2010-08-08 12:34')
MJD= 55416.52361, MJDseconds = 4787987640.0, JD= 2455417.02361
  Out[4]: 55416.523611111108

-- ToddHunter - 2012-08-28
Topic revision: r6 - 2015-01-22, ToddHunter
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback