Difference between revisions of "Now"

From SDU
Jump to: navigation, search
 
Line 7: Line 7:
 
{{Global Announcement}}
 
{{Global Announcement}}
 
== Overview ==
 
== Overview ==
Return current date and time in Unix datetime format.
+
Return current date and time in datetime format. It can be converted to Unix timestamp using cast to int.
  
 
== Usage ==
 
== Usage ==
 
<source lang="javascript">
 
<source lang="javascript">
int now()
+
date now()
 
</source>
 
</source>
  
 
== Results ==
 
== Results ==
Current date and time in Unix datetime format.
+
Current date and time in datetime format.
  
 
== Examples ==
 
== Examples ==
Line 22: Line 22:
 
alg.time_spent = now() - time_stamp;
 
alg.time_spent = now() - time_stamp;
  
if (now() > need_by) {
+
if ((int)now() > (int)need_by-600) {
 
set_return_data(TRUE);
 
set_return_data(TRUE);
 
} else {
 
} else {

Latest revision as of 13:11, 21 August 2009

To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.

Overview

Return current date and time in datetime format. It can be converted to Unix timestamp using cast to int.

Usage

<source lang="javascript"> date now() </source>

Results

Current date and time in datetime format.

Examples

<source lang="javascript"> chg.modified_date = now(); alg.time_spent = now() - time_stamp;

if ((int)now() > (int)need_by-600) { set_return_data(TRUE); } else { set_return_data(FALSE); } </source>