Freelance Project Requests info@CodeDocu.de Software Development in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net
#

 

 

 

How to add a date value to a SQLite table?

 
Date with time Transfer with Values: 
2018-10-04 05:39:22
YYYY-MM-dd hh:mm:ss
 
Date as day Transfer with Values: 
20180811

YYYYMMdd

 

 

Java code example

//< set_Values >
String sDay = clsDate.format_to_ShortDate(dtDay);
String sNow = clsDate.format_to_Date_SQLite(
new Date());


ContentValues values = new ContentValues();
values.put(
"dtDay", sDay);
values.put(
"dtEdit", sNow);
//</ set_Values >

//< add >
long newID = db.insert("tbl_Notes", null, values);
//</ add >

 

 

 

In doing so, SQLite recognizes the date format of the string when saving.

 

Here is the database at runtime.

In the left column you can see the short day-date

And in the dtEdit column is a detailed date with day-time

Mobile
»
SQLite: save date
»
SQLite Database in Android: Complete Code Example
»
Sqlite: change values
»
SQLite: new ID at Insert Add
»
Evaluate SQLite on Android App

.

Contact for Jobs, Project Requests: raimund.popp@microsoft-programmierer.de