Usage for dateStringToMJDSec

Return to directory of Todd's CASA extensions

This function converts a date string into MJD seconds. This value is useful for passing time ranges to plotms, because they must be specified in mjd seconds (see CAS-3270). See also dateStringToMJD and strDate2MJD.


au.dateStringToMJDSec(datestring='2011/10/15 05:00:00', datestring2='', verbose=True, use_metool=True)
  • Any of these formats is valid:
    • 2011/10/15 05:00:00 or 2011-10-15 05:00:00
    • 2011/10/15-05:00:00 or 2011-10-15-05:00:00
    • 2011/10/15T05:00:00 or 2011-10-15T05:00:00 or 2011-Oct-15 05:00:00
  • The time portion is optional.
  • If a second string is given, both values will be converted and a string will be created that can be used as a plotrange in plotms.
  • Returns the value in seconds.
  • use_metool: if True, use the casa measures tool; otherwise use a acanned formula for converting to MJD


CASA <8>: au.dateStringToMJDSec('2011/10/15 05:10:54','2011/10/15 05:11:54')
MJD= 55849.21590, MJDseconds = 4825372254.0
plotrange = [4825372254.0, 4825372314.0, 0, 0]
  Out[8]: [4825372254.0, 4825372314.0]

-- ToddHunter - 2011-11-22
Topic revision: r8 - 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