Forum Index

No notifications
Notifications

Favorites

No favorites found
General Training Discussion General chat and comment on KnowledgeKube training
KnowledgeKube Training > General Training Discussion > Insert datetime into MSSQL View modes: 
User avatar
KnowledgeKube Staff
KnowledgeKube Staff
andrew.matthews - 11/07/2016 12:38:23
   
RE:Insert datetime into MSSQL
The 0 represents the date-time value being passed into WriteData, everything after the colon indicates how this value is formatted. Thanks

User avatar
Advanced member
Advanced member
Arun Murthy - 11/07/2016 10:36:07
   
RE:Insert datetime into MSSQL
Hi Andrew, I already try and it works as stated. But may I know what does the number zero mean in the "{0:MM/dd/yyyy HH:mm}"? Thanks

User avatar
KnowledgeKube Staff
KnowledgeKube Staff
andrew.matthews - 11/07/2016 10:09:16
   
RE:Insert datetime into MSSQL
Hi Arun, When writing dates to a datasource using WriteData you need to include the date format in the WriteData expression through an optional parameter DateFormat. These optional parameters can be found by using the Intellisense feature (CTRL + Space) and using the Up and Down arrows to cycle through optional parameters. You can tell if a function has optional parameters by looking for the X of X in the top left corner, like in the attached screenshot for WriteData.
WriteData(NewData, RowID, DataSource, GenerateIndex, DateFormat);
This are all the parameters for WriteData, DateFormat should match the format of the DateTime data being written away, with some extra characters added. Using the format you've included above you're write data should look like this.
WriteData(NewData, RowID, DataSource, "False", "{0:MM/dd/yyyy HH:mm}");
Note: As a value if being given to DateFormat, a value must also be given to GenerateIndex the default is "False". This should solve your issues with the time not being included, if you have any further problems with this just let me know. Kind Regards
Post attachments:

User avatar
Advanced member
Advanced member
Arun Murthy - 09/07/2016 04:50:17
   
Insert datetime into MSSQL
Hi, I want to add date and time to the column type datetime in MSSQL. But it only add the date, not the time FreeTextDateTime value format is "dd/MM/yyyy HH:mm" // Convert date format from dd/MM/yyyy into MM/dd/yyyy; Datetime:= ""&GetDateTimeFormat("MM/dd/yyyy HH:mm","en-GB",FreeTextDateTime,"en-GB"); Kind Regards

RSS Feed