Docstoc

Current date-time in Date Field

Document Sample
Current date-time in Date Field Powered By Docstoc
					Current date-time in Date Field
Concat(Num2Date(Date(), "DD/MM/YYYY"), " ", Num2Time(Time(), "HH:MM"))
-------------------------------------------------------------------------
-------

Display date in future/past thru calculation.
1. Lets say you have From Date Field named Date1. In Object palette ->
Select Field Tab -> Enter / select a value for Display Pattern --> I
selected "MM/DD/YYYY" as the pattern.

2. In the click event of the button, select language as FormCalc and add
following code:-

if (Date1.rawValue ne null) then
    Date1.formattedValue = Num2Date(Date2Num(Date1.formattedValue,
"MM/DD/YYYY") - 7, "MM/DD/YYYY")
else
    null
endif
-------------------------------------------------------------------------
-------

Display date in capital letter.
$.rawValue = Num2Date(Date(), "DD.MMMM.YYYY");
var ind = At($.rawValue, ".");
var day = Left($.rawValue, (ind-1));
var sub = Right($.rawValue,(Len($.rawValue)-ind));
var ind2 = At(sub,".");
var year = Substr(sub,(ind2+1),(Len(sub)-ind2));
ind = ind +1;
var month = Substr(sub,1,(ind2-1));
month = Upper(month);
$.rawValue = Concat(day,".",month,".",year);

OR

$.rawValue = Upper(Format("DD.MMM.YYYY", $.rawValue))
-------------------------------------------------------------------------
-------

Date calculation for two time fields.
if(startDate.isNull or endDate.isNull) \\ keep calculation clean
then $ = 0
else $=Time2Num(startTime.formattedValue, "HH:MM") -
Time2Num(endTime.formattedValue, "HH:MM")
endif

				
DOCUMENT INFO
Shared By:
Tags:
Stats:
views:22
posted:11/1/2010
language:English
pages:1