Tuesday, August 11, 2009

How to Create Date offset in LR

just for my work, i have to create Date offset in LR myself, hopefully it is helpful for you as well, it is just a simple example, you can use yours:)

lr_save_datetime("%d", DATE_NOW, "Day1");
lr_save_datetime("%m", DATE_NOW, "Mon1");
lr_save_datetime("%Y", DATE_NOW, "Year1");

if ((atoi(lr_eval_string("{Day1}"))+atoi(lr_eval_string("{round1}")))<= 29)

{


lr_save_int(atoi(lr_eval_string("{Day1}"))+atoi(lr_eval_string("{round1}")), "param1");
lr_save_int(atoi(lr_eval_string("{Mon1}")), "param2");
lr_save_int(atoi(lr_eval_string("{Year1}")), "param3");

lr_output_message("parameter is %s-%s-%s", lr_eval_string("{param3}"),lr_eval_string("{param2}"),lr_eval_string("{param1}"));


}

else if ((atoi(lr_eval_string("{Day1}"))+atoi(lr_eval_string("{round1}")))> 29 && atoi(lr_eval_string("{Mon1}"))<12)

{

lr_save_int(atoi(lr_eval_string("{Day1}"))+atoi(lr_eval_string("{round1}"))-29, "param1");
lr_save_int(atoi(lr_eval_string("{Mon1}"))+1, "param2");
lr_save_int(atoi(lr_eval_string("{Year1}")), "param3");

lr_output_message("parameter is %s-%s-%s", lr_eval_string("{param3}"),lr_eval_string("{param2}"),lr_eval_string("{param1}"));

}


else if ((atoi(lr_eval_string("{Day1}"))+atoi(lr_eval_string("{round1}")))> 29 && atoi(lr_eval_string("{Mon1}"))==12)

{

lr_save_int(atoi(lr_eval_string("{Day1}"))+atoi(lr_eval_string("{round1}"))-29, "param1");
lr_save_int(01, "param2");
lr_save_int(atoi(lr_eval_string("{Year1}"))+1, "param3");

lr_output_message("parameter is %s-%s-%s", lr_eval_string("{param3}"),lr_eval_string("{param2}"),lr_eval_string("{param1}"));

}

No comments:

Post a Comment