sql-string. Getting date in DBMS-style format

^date.sql-string[]

Method transforms the date into
YYYY-MM-DD HH:MM:SS format, used by DBMS for storing dates. Using this method you can add date values to DB without any additional transformations.

Example
$date_now[^date::now[]]
^
connect[connect string]{
   ^
void:sql{insert into access_log
      (access_date)
   values
      ('
^date_now.sql-string[]
')
   
}
}

We get string of format '
2001-11-30 13:09:56' with current date and time and at once place it into a DB field. Without this method at hand, we would have to put together the needed strings manually. Note: the method doesn't form the apostrophes-you should add them by yourself.


Copyright © 1997–2010 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 20.09.2007