Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » formatting time to pass to sqlite
formatting time to pass to sqlite [message #52276] Mon, 26 August 2019 02:28 Go to next message
mtdew3q is currently offline  mtdew3q
Messages: 181
Registered: July 2010
Location: Upstate, NY (near Canada)
Experienced Member

Hi-

I am fooling with homebudget trying to get dates and times formatted to send to SQLite.
I can get the date part sent but the time is not working.

struct ConvTime1 : Convert 
{
	Value Format(const Value &q) const
	{
	    Time t = (Time) q;
	    return q.IsNull() ? "" : UPP::Format("%.2d/%.2d/%.4d %.2d:%.2d:%.2d",    t.month, t.day, t.year, t.hour, t.minute, t.second);
         }
    
};


	events.AddColumn(START_TIME).Edit(t1).SetConvert(Single<ConvTime1>()).Default(GetSysTime());


This code returns in sqlite db 2019-08-25 and omits the time information.
T1 is an EditString.
START_TIME is an integer in sqlite.

Thanks for any cool tips for persisting time.

roboloki
Re: formatting time to pass to sqlite [message #52277 is a reply to message #52276] Mon, 26 August 2019 02:41 Go to previous messageGo to next message
mtdew3q is currently offline  mtdew3q
Messages: 181
Registered: July 2010
Location: Upstate, NY (near Canada)
Experienced Member

Hi-

I think I found an example how to do this. I will post back with results. TIA biobytes.

roboloki
Re: formatting time to pass to sqlite [message #52278 is a reply to message #52277] Mon, 26 August 2019 03:18 Go to previous message
mtdew3q is currently offline  mtdew3q
Messages: 181
Registered: July 2010
Location: Upstate, NY (near Canada)
Experienced Member

Hi guys-

I got stuck mainly because I used a EditString to try to capture the contents of time or date instead of a EditDate or EditTime.

Have a very cool week,
roboloki
Previous Topic: How to share a schema .sch with multiple header and source files
Next Topic: date not showing in sqlarray
Goto Forum:
  


Current Time: Thu Mar 28 13:08:05 CET 2024

Total time taken to generate the page: 0.01232 seconds