Here is the MySQL function to use to get the current datetime as ISO 8601 format as asked in DarwinCore:
DATE_FORMAT(NOW(),'%Y-%m-%dT%TZ')
DATE_FORMAT()
is obviously a function for formatting date and time, and we are using here %Y
for four-digit year, %m
for two-digits month, %d
for two-digits day and %T
for 24-hour time (hh:mm:ss). NOW()
gives the current datetime.
And then you get a nice figure like this one:
2009-06-10T07:43:12Z
Note that the same result can be achieved with:
CONCAT(CURDATE(),'T',CURTIME(),'Z')
Where CONCAT()
is used for concatenating strings, and CURDATE()
and CURTIME()
give respectively the current date and the current time.
UPDATE: There is now a page for getting the current datetime in different formats. Check the page here: Get the current date in different formats in MySQL.