Newer Version Available
now()
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().
1q = load "DTC_Opportunity";
2q = foreach q generate date_diff("week", toDate(Created_Date_sec_epoch), now() ) as 'Weeks to Close';
3q = order q by 'Weeks to Close';Example
What is the date today? Use now() inside date_to_string().
1q = load "DTC_Opportunity";
2
3-- Notice how the ' character is escaped with the \ character in 'Today\'s
4q = foreach q generate date_to_string(now(), "yyyy-MM-dd") as 'Today\'s Date';