Origin C provides support for date and time data.
// Get current time time_t aclock; time( &aclock ); // Converts a time value and corrects for the local time zone TM tmLocal; convert_time_to_local(&aclock , &tmLocal); // Convert time value from TM format to system time format SYSTEMTIME sysTime; tm_to_systemtime(&tmLocal, &sysTime); // Get date string from system time char lpcstrTime[100]; if(systemtime_to_date_str(&sysTime, lpcstrTime, LDF_SHORT_AND_HHMM_SEPARCOLON)) printf("Current Date Time is %s\n", lpcstrTime);
SYSTEMTIME st; GetSystemTime(&st); // Gets current date time double dJulianDate; SystemTimeToJulianDate(&dJulianDate, &st); // Convert to Julian date // Convert Julian date to string with the specified format string strDate = get_date_str(dJulianDate, LDF_SHORT_AND_HHMM_SEPARCOLON); out_str(strDate);
string strDate = "090425 17:59:59"; double dt = str_to_date(strDate, LDF_YYMMDD_AND_HHMMSS);