gdalinis
(Fresh Scripter)
2008-09-18 04:10 PM
Previous Day Script

Hi All,

Was wondering if anyone had sample code that figures out the previous day and also knows if it is the 1st of the month, the previous day rolls back a month and knows the last calendar day of the previous month?

Thanks!

Gus


Mart
(KiX Supporter)
2008-09-18 04:40 PM
Re: Previous Day Script

I think there are some UDF's in the UDF section that are able to do (almost) waht you want. Have a look in the UDF section.

AllenAdministrator
(KiX Supporter)
2008-09-18 07:25 PM
Re: Previous Day Script

I use SerialDate, found in the UDF section, for all things like this.
http://www.kixtart.org/forums/ubbthreads...=true#Post82573

for example
 Code:
$yesterday=serialdate(serialdate(@date)-1)
? $yesterday


or to break it down
 Code:
? @date
$today=serialdate(@date)
? $today
$yesterday=serialdate(@date)-1
? $yesterday
$yesterday=serialdate($yesterday)
? $yesterday


gdalinis
(Fresh Scripter)
2008-09-18 08:11 PM
Re: Previous Day Script

OK ... call me a Noob ... but I have no idea what a UDF is. I am not a programmer but I do know kix as far as using all the stuff in the documentation.

When I try to use the code example:

$yesterday=serialdate(serialdate(@date)-1)

I get the following error:
ERROR : expected ')'!

Thanks for the help.


AllenAdministrator
(KiX Supporter)
2008-09-18 08:13 PM
Re: Previous Day Script

Okay... Mr. Noob ;\)

Follow the link provided above. Copy the function to the bottom of your script. Use the example provided above... whala!


Richard H.Administrator
(KiX Supporter)
2008-09-19 08:59 AM
Re: Previous Day Script

 Originally Posted By: gdalinis
OK ... call me a Noob ... but I have no idea what a UDF is. I am not a programmer but I do know kix as far as using all the stuff in the documentation.


"Noob" is not so good, I prefer "Gus Dalinis Systems Analyst" - it sounds like a cracking daytime TV show about a forensic computer scientist who solves cases that defeat the local law enforcement.

Back from the plot... UDFs are described in the documentation and there is also a little more detail to be found in the FAQ forum: http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943