1LoL1 Posted November 30, 2015 Share Posted November 30, 2015 (edited) Hello, can anyone help me how i can use in this code string.format? i mean 01:01:01 not 1:1:1 please can anyone help me? dbExec( database, "INSERT INTO TEST ( Data, Data2, Data3, Data4 ) VALUES ( ?, ?, ?, ?)", data, data2, "["..day.."/"..month.."/"..year.."]", "["..hour..":"..min..":"..sec.."]") Edited November 30, 2015 by Guest Link to comment
myonlake Posted November 30, 2015 Share Posted November 30, 2015 function getDateTimeString( day, month, year, hour, minute, second ) return ( "%04d-%02d-%02d %02d:%02d:%02d" ):format( year or 0, month or 0, day or 0, hour or 0, minute or 0, second or 0 ) end So technically you can just modify that to your needs like so: function getDateTimeString( day, month, year, hour, minute, second ) return ( "[%02d/%02d/%04d]" ):format( year or 0, month or 0, day or 0 ), ( "[%02d:%02d:%02d]" ):format( hour or 0, minute or 0, second or 0 ) end local dateString, timeString = getDateTimeString( ... ) Link to comment
1LoL1 Posted November 30, 2015 Author Share Posted November 30, 2015 function getDateTimeString( day, month, year, hour, minute, second ) return ( "%04d-%02d-%02d %02d:%02d:%02d" ):format( year or 0, month or 0, day or 0, hour or 0, minute or 0, second or 0 ) end So technically you can just modify that to your needs like so: function getDateTimeString( day, month, year, hour, minute, second ) return ( "[%02d/%02d/%04d]" ):format( year or 0, month or 0, day or 0 ), ( "[%02d:%02d:%02d]" ):format( hour or 0, minute or 0, second or 0 ) end local dateString, timeString = getDateTimeString( ... ) Thanks but i don't know how i can use in my code.. Link to comment
1LoL1 Posted November 30, 2015 Author Share Posted November 30, 2015 Ok i fixed. So it's solved. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now