Reputation: 1193
I want to add 2 zero to the right of the next function: UNIX_TIMESTAMP (NOW()),
So instead of: 1369047810
, I would get: 136904781000
I try this:
SELECT (UNIX_TIMESTAMP (NOW()) + RIGHT(REPLICATE('0', 2))))
but it doesn't help.
Upvotes: 0
Views: 132
Reputation: 1269663
If you want it as a string, then you want to convert it to a string and then add the zeros. Something like:
SELECT (cast(UNIX_TIMESTAMP (NOW()) as varchar(255) + RIGHT(REPLICATE('0', 2))))
I think the string conversion is safer than doing arithmetic, if you want a string in the end. Multiplying values might cause arithmetic overflow.
Also, I associate the syntax UNIX_TIMESTAMP (NOW())
with MySQL (as I write this, there is no database tag on the question). The right syntax in that database would be:
select concat(cast(UNIX_TIMESTAMP (NOW()) as varchar(255), '00')
Upvotes: 1