FLUENT 6 - how to print the current date and time from within a User Defined Function (UDF)
This solution provides a sample UDF that shows how to print the current date and time according to a specified format. It uses the "strftime" utility that is available on UNIX and LINUX platforms.
The C standard library includes a header <time.h> which allows you to do this. Just include this header and you are set. As an example, I've written a UDF that prints out the date and time according to the format
MM:HH on "Day of the Week", "Month name" Day, Year
More print string options are available: Just do a "man strftime" from your unix prompt.
t = time(NULL);
strftime(datestring, sizeof(datestring), "%R on %A, %d %B, %Y", localtime(&t));