Hi,
How can I have a text object with data + time?
Thank You,
Best Regards,
Rui
Welcome to the nuBuilder forums!
Please register and login to view forums and other content only available to registered users.
Please register and login to view forums and other content only available to registered users.
Date and Time
-
- Site Admin
- Posts: 2781
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 1 time
Re: Date and Time
Rui,
You can just use a wider text area and make a JavaScript function to validate it.
http://stackoverflow.com/questions/4460 ... javascript
nuBuilder has no built in format for that.
Steven
You can just use a wider text area and make a JavaScript function to validate it.
http://stackoverflow.com/questions/4460 ... javascript
nuBuilder has no built in format for that.
Steven
-
- Posts: 177
- Joined: Tue Nov 15, 2011 2:24 pm
Re: Date and Time
Hi Steven,
I am using in the form "before open":
Result is not correct! I get tomorrows date.
If I use:
... the now() function doesn't work!
Any idea why is not working? I have checked the dates in my systems and are correct.
Thank you!
Best regards,
Rui
I am using in the form "before open":
Code: Select all
$sql = "SELECT CURDATE() AS date";
$result = nuRunQuery($sql);
$date = db_fetch_object($result);
$date = date("d-M-Y");
$javascript = " function nuLoadThis() {\n";
$javascript .= " if (document.getElementById('unit_date').value == ''){\n";
$javascript .= " document.getElementById('unit_date').value = '".$date."';\n";
$javascript .= "}}\n";
addJSFunction($javascript);
If I use:
Code: Select all
$sql = "SELECT now() AS date";
$result = nuRunQuery($sql);
$date = db_fetch_object($result);
$date = date("d-M-Y H:i:s");
$javascript = " function nuLoadThis() {\n";
$javascript .= " if (document.getElementById('unit_date').value == ''){\n";
$javascript .= " document.getElementById('unit_date').value = '".$date."';\n";
$javascript .= "}}\n";
addJSFunction($javascript);
... the now() function doesn't work!
Any idea why is not working? I have checked the dates in my systems and are correct.
Thank you!
Best regards,
Rui
BR
Rui
Rui
-
- Posts: 2
- Joined: Wed Apr 04, 2012 11:08 am
-
- Posts: 177
- Joined: Tue Nov 15, 2011 2:24 pm
Re: Date and Time
Hi MichaelD,
Yes it is correct:
mysql> SELECT CURDATE() AS date;
+------------+
| date |
+------------+
| 2012-04-17 |
+------------+
1 row in set (0.00 sec)
-----
Any other idea?
Best Regards,
Rui
Yes it is correct:
mysql> SELECT CURDATE() AS date;
+------------+
| date |
+------------+
| 2012-04-17 |
+------------+
1 row in set (0.00 sec)
-----
Any other idea?
Best Regards,
Rui
BR
Rui
Rui
-
- Site Admin
- Posts: 2781
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 1 time
Re: Date and Time
Rui,
this will give you date and time
Steven
this will give you date and time
Code: Select all
$sql = "SELECT now() AS date";
$table = nuRunQuery($sql);
$row = db_fetch_row($table);
$date = $row[0];
-
- Posts: 177
- Joined: Tue Nov 15, 2011 2:24 pm