<p>I'm guessing it needs to be something like:</p>

<pre><code>CONVERT(CHAR(24), lastModified, 101)
</code></pre>

<p>However I'm not sure of the right value for the third parameter.</p>

<p>Thanks!</p>

<hr>

<p>Well I'm trying to write a script to copy my sql server db to a sqlite file, which gets downloaded to an air app, which then syncs the data to another sqlite file. I'm having a ton of trouble with dates. If I select a date in air and try to insert it, it fails because it's not in the right format... even if it was a valid date to begin with. I figured I'd try to experiment with the unix time since that's the only thing thats worked so far. I am considering just leaving them as varchar because I don't sort by them anyway.</p>

[{'answer_id': 11213, 'author': 'Stu', 'author_id': 414, 'author_profile': 'https://Stackoverflow.com/users/414', 'pm_score': 0, 'selected': False, 'text': '<p>Define "last epoch". Does this come close?</p>\n\n<p>Select Cast(lastModified As Integer)</p>\n'}, {'answer_id': 11216, 'author': 'SQLMenace', 'author_id': 740, 'author_profile': 'https://Stackoverflow.com/users/740', 'pm_score': 2, 'selected': False, 'text': '<p>Last epoch is when 1970 GMT?</p>\n\n<pre><code>SELECT DATEDIFF(s,\'19700101 05:00:00:000\',lastModified)\n</code></pre>\n\n<p>See also <a href="http://wiki.lessthandot.com/index.php/Epoch_Date" rel="nofollow noreferrer">Epoch Date</a></p>\n'}, {'answer_id': 11229, 'author': 'Stu', 'author_id': 414, 'author_profile': 'https://Stackoverflow.com/users/414', 'pm_score': 0, 'selected': False, 'text': '<p>If you store them as varchar, store them as YYYYMMDD. That way you CAN sort by them later if you want to.</p>\n'}, {'answer_id': 11234, 'author': 'SQLMenace', 'author_id': 740, 'author_profile': 'https://Stackoverflow.com/users/740', 'pm_score': 0, 'selected': False, 'text': '<p>SQL server has only 2 failsafe date formats</p>\n\n<p>ISO = YYYYMMDD, run this to see that </p>\n\n<pre><code>  select convert(varchar(10),getdate(),112)\n</code></pre>\n\n<p>ISO8601 = yyyy-mm-dd Thh:mm:ss:mmm(no spaces) run this to see that </p>\n\n<pre><code>select convert(varchar(30),getdate(),126)\n</code></pre>\n\n<p>To learn more about how dates are stored in SQL server I wrote <a href="http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/how-are-dates-stored-in-sql-server" rel="nofollow noreferrer">How Are Dates Stored In SQL Server?</a></p>\n'}, {'answer_id': 11240, 'author': 'Shawn', 'author_id': 26, 'author_profile': 'https://Stackoverflow.com/users/26', 'pm_score': 2, 'selected': True, 'text': '<p>I wound up using format 120 in MS SQL: </p>\n\n<pre><code>convert(char(24), lastModified, 120)\n</code></pre>\n\n<p>Each time I needed to a select a date in SQLite for non-display purposes I used:</p>\n\n<pre><code>strftime(\\"%Y-%m-%d %H:%M:%S\\", dateModified) as dateModified\n</code></pre>\n\n<p>Now I just need a readable/friendly way to display the date to the user!</p>\n\n<p>edit: accept answer goes to whoever shows me how to display the date nicely from sqlite ;p</p>\n'}, {'answer_id': 4820954, 'author': 'Noah', 'author_id': 12113, 'author_profile': 'https://Stackoverflow.com/users/12113', 'pm_score': 2, 'selected': False, 'text': "<p>sqlite> <strong>select datetime();</strong><br>\n2011-01-27 19:32:57</p>\n\n<p>sqlite> <strong>select strftime('%Y-%m-%d %H:%M:%S','now');</strong><br>\n2011-01-27 19:33:57 </p>\n\n<p><strong>REFERENCE:</strong><br>\n(Date time Functions)[http://sqlite.org/lang_datefunc.html]</p>\n"}]
['https://Stackoverflow.com/questions/11200', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/26/']