Hi thanks for the reply. I am new to this. I presume it is the z on the end that is the issue. Not sure what I need to do to fix it. Can you give some guidance please.
So the date is OK, but you need to replace the "T" with a space and then lose everything after the seconds value.
The simplest way to do that would be to use my node-red-contrib-moment node. A slightly more complex way would be to use a change node or a function node to fixup the text.
It has raised another question for me, would you advise that I use a different database from mysql, due to this sort of limitation. I don't want to spend a load of time learning something that is in the dark ages so to speak. Do you have any suggestions for an alternative. This is to hold data that will be used for reports and plotting on graphs.
Also the install of your node fails with this,
2019-06-03T20:16:33.552Z Install : node-red-contrib-moment 3.0.2
2019-06-03T20:16:31.949Z npm install --no-audit --no-update-notifier --save --save-prefix="~" --production node-red-contrib-moment@3.0.2
2019-06-03T20:16:39.117Z [err] npm
2019-06-03T20:16:39.117Z [err] ERR! path /root/snap/node-red/309/node_modules/node-red-contrib-uibuilder
2019-06-03T20:16:39.117Z [err] npm ERR!
2019-06-03T20:16:39.117Z [err] code
2019-06-03T20:16:39.117Z [err] EISGIT
2019-06-03T20:16:39.117Z [err] npm ERR!
2019-06-03T20:16:39.118Z [err] git /root/snap/node-red/309/node_modules/node-red-contrib-uibuilder: Appears to be a git repo or submodule.
2019-06-03T20:16:39.118Z [err] npm ERR!
2019-06-03T20:16:39.118Z [err] git
2019-06-03T20:16:39.118Z [err] /root/snap/node-red/309/node_modules/node-red-contrib-uibuilder
2019-06-03T20:16:39.118Z [err] npm
2019-06-03T20:16:39.118Z [err] ERR!
2019-06-03T20:16:39.118Z [err] git Refusing to remove it. Update manually,
2019-06-03T20:16:39.118Z [err] npm
2019-06-03T20:16:39.118Z [err] ERR!
2019-06-03T20:16:39.118Z [err] git or move it out of the way first.
2019-06-03T20:16:39.178Z [err]
2019-06-03T20:16:39.178Z [err] npm ERR! A complete log of this run can be found in:
2019-06-03T20:16:39.178Z [err] npm
2019-06-03T20:16:39.178Z [err] ERR! /root/snap/node-red/309/.npm/_logs/2019-06-03T20_16_39_120Z-debug.log
2019-06-03T20:16:39.189Z rc=1
I am not so sure this is not an issue on my install with your node install. I can't seem to install any new nodes. Have you ever come across this before ?
Nope, there was something wrong with the npm package.
If you can, please go to your userDir folder on the server (usually ~/.node-red). Delete the file called package-lock.json. Then install moment manually using:
cd ~/.node-red
npm install node-red-contrib-moment
This should install v3.0.3 which has no changes other than the version number changed but seems to fix the issue.
Different issue I'm afraid. Somehow the moment npm package seems to have gotten packed with something related to one of my other nodes, uibuilder. Not sure how since the readme in npm and the version numbers are correct for moment not uibuilder.
Anyway, sorted now. It will just take the flows site a little while to catch up so you need to install manually for an hour or so.
OK, it seemed to me that this is exactly the error that the uibuilder problem was causing. root/snap/node-red/309/node_modules/node-red-contrib-uibuilder: Appears to be a git repo or submodule.
However if it is all sorted then that's fine, obviously.
Ok guys, thanks for your help I will try this tonight at home. Rather odd, but tried the above with sending Mqtt data to MYSQL on my work test rig, which is exaclty the same as my home one. Home one does not work, due to the timestamp format, yet the work one does.
Since you have a work rig and a home rig, I'm going to guess there are two different MySQL environment/databases. What is the column defined as in the work rig? (UPDATE: corrected the typo)