3
How can I get the current server date and put it in my query to send to the database? I have no idea how I can take the current time and put in a variable to send to the bank, thank you.
3
How can I get the current server date and put it in my query to send to the database? I have no idea how I can take the current time and put in a variable to send to the bank, thank you.
4
You can do that in bank language.
If it’s Mysql you can use NOW()
that gives YYYY-MM-DD HH:MM:DD
date and time.
In PHP there are several ways, one of them date("Y-m-d H:i:s")
, another is
$now = new DateTime();
$datetime = $now->format('Y-m-d H:i:s');
Fatal error: Call to Undefined Function NOW() in WAY
When I use NOW on Insert
@Evertonfigueiredo You got confused :) ... NOW
not a PHP function is a mysql function, ie it should be a string in PHP within the query and not a function call, something like "INSERT INTO soFoo (first,last,minhadata) VALUES (0,1,Now())"
Thanks I was putting in the wrong place anyway.
Browser other questions tagged php
You are not signed in. Login or sign up in order to post.
You can do this in the database language. If it is Mysql you can use
NOW()
. Have you tested this? In PHP there are several ways, one of themdate("Y-m-d H:i:s")
– Sergio
NOW() takes date and time? I have not tested
– Everton Figueiredo
Exact, like
YYYY-MM-DD HH:MM:DD
– Sergio
Fatal error: Call to Undefined Function NOW() PATH
– Everton Figueiredo