Returns the current datetime in UTC. This function is only valid in a foreach statement.
Syntax
now()
Usage
This function is commonly used with daysBetween(), date_diff(), and date_to_string().
Example
How long ago was each opportunity created, in weeks? Use date_diff(), datepart = week, and now().
q = load "DTC_Opportunity";
q = foreach q generate date_diff("week", toDate(CreatedDate_sec_epoch), now() ) as 'Weeks to Close';
q = order q by 'Weeks to Close';
Example
What is the date today? Use now() inside date_to_string().
q = load "DTC_Opportunity";
-- Notice how the ' character is escaped with the \ character in 'Today\'s
q = foreach q generate date_to_string(now(), "yyyy-MM-dd") as 'Today\'s Date';
See Also