Description
Converts the calendar-based epoch specified by the String into the TAI numeric time system. The format of the input String is given by formatString. The format string can include the date and time formats shown in the "Parsing Dates and Times" reference in the Help File, including month, day, year, hours, minutes, and seconds. If formatString does not fully define a time, the necessary data will be filled in using the reference time "Jan 01 2000 00:00:00.000" (epoch 21544.500370370).
Timing Precision Mode
This page describes functionality in millisecond timing precision mode. Millisecond timing precision mode is deprecated and will be removed in a future release. We recommend that you migrate your Mission Plans to nanosecond timing precision mode.
Method Signature
String.EpochScan(
|
String formatString)
|
Arguments
formatString
|
|
Description:
|
Specifies the format of the String object. The format string can include the date and time formats shown in the "Parsing Dates and Times" reference in the Help File, including month, day, year, hours, minutes, and seconds. If a format string is not specified, the format "Mmm DD YYYY hh:mm:ss.fs" will be used.
|
Return Value
Returns the calendar-based epoch specified by the String in the specified numeric time system.
Syntax
myVariable1 = myString1.EpochScan(myString2);
|
Variable1 = "2009 12 11".EpochScan("YYYY DD hh");
Report Variable1, Variable1.EpochFormat();
|
Output:
Variable1 = 24843.958726852
Variable1.EpochFormat() = Jan 12 2009 11:00:00.000
|
The following example uses both EpochScan and EpochFormat to apply even minute rounding to an epoch defined by a String.
Variable Epoch;
Variable EvenMinuteEpoch;
String StringDate;
String StringEvenMinuteDate;
// Apply even minute rounding
StringDate = "Jul 04 2005 12:34:56.789";
// Scans string and converts to variable
Epoch = StringDate.EpochScan("Mmm DD YYYY hh:mm:ss.sss");
// Reads variable and converts to String, using "00.000" for seconds
StringEvenMinuteDate = Epoch.EpochFormat("Mmm DD YYYY hh:mm:00.000");
// Scans string and converts to variable
EvenMinuteEpoch = StringEvenMinuteDate.EpochScan("Mmm DD YYYY hh:mm:ss.sss");
// Observe results
Watch StringDate, Epoch, StringEvenMinuteDate, EvenMinuteEpoch;
|
Output:
StringDate = Jul 04 2005 12:34:56.789
Epoch = 23556.0246387616
StringEvenMinuteDate = Jul 04 2005 12:34:00.000
EvenMinuteEpoch = 23556.0239814815
|
The following example uses both EpochScan and EpochFormat to apply a 65.5 day offset to the initial epoch given by a String.
Variable Epoch;
Variable ShiftedEpoch;
String StringDate;
// Given a DOY YYYY format apply 65.5 day offset...
StringDate = "326 2004 12:34:56.789";
Epoch = StringDate.EpochScan("DOY YYYY hh:mm:ss.sss");
ShiftedEpoch = Epoch + 65.5;
Watch StringDate, Epoch.EpochFormat("Mmm DD YYYY hh:mm:ss.sss"), ShiftedEpoch.EpochFormat("Mmm DD YYYY hh:mm:ss.sss");
|
Output:
StringDate = 326 2004 12:34:56.789
Epoch.EpochFormat("Mmm DD YYYY hh:mm:ss.sss") = Nov 21 2004 12:34:56.789
ShiftedEpoch.EpochFormat("Mmm DD YYYY hh:mm:ss.sss") = Jan 26 2005 00:34:56.789
|
See also
String Object
String.EpochScan
Parsing Dates and Times
Parsing Dates and Times
Parsing Arbitrary String Data
Parsing Arbitrary String Data
|