I can show you how to do this in Origin C, but you probably need Origin 7.5 or later,
// assume strDate = dd.MM.year hh:mm:ss format
void dd(string strDate, string strYear)
{
string strDateFormat = "dd'.'MM'.'yyyy hh':'mm':'ss";
double yy;
if( str_to_date_custom(strDate, strDateFormat, &yy) )
{
string strDateRef = "1.1." + strYear + " 00:00:00";
double y0;
if(str_to_date_custom(strDateRef, strDateFormat, &y0))
{
printf("date offset from start of year %s is %g days\n", strYear, yy - y0);
return;
}
}
out_str("error in date format");
}
To test, enter
dd "1.1.2005 23:34:02" 2005
should print out
date offset from start of year 2005 is 0.981968 days
Date is internally represented as Julian Days, so once converted to Julian Days, you can calculate whatever you need to.
CP