Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
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(CreatedDate_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';