Wednesday, March 26, 2014

SQL DateTime Conversion to many style (Formats)

USE AdventureWorks
SET LANGUAGE us_english
-- Convert string to date using style (format) numbers - sql dates format
-- SQL convert text to date - SQL convert string to date / datetime
SELECT convert(datetime,'15/03/18',3) -- 2018-03-15 00:00:00.000
SELECT convert(datetime,'15.03.18',4) -- 2018-03-15 00:00:00.000

-- Convert datetime to text style (format) list - sql time format
-- SQL Server without century (YY) date styles (there are exceptions!)
-- Generally adding 100 to style number results in century format CCYY / YYYY
SELECT convert(varchar,getdate())    -- Mar 15 2018 10:35AM
SELECT convert(varchar,getdate(),0)  -- Mar 15 2018 10:35AM
SELECT convert(varchar,getdate(),1)  -- 03/15/18
SELECT convert(varchar,getdate(),2)  -- 18.03.15
SELECT convert(varchar,getdate(),3)  -- 15/03/18
SELECT convert(varchar,getdate(),4)  -- 15.03.18
SELECT convert(varchar,getdate(),5)  -- 15-03-18
SELECT convert(varchar,getdate(),6)  -- 15 Mar 18
SELECT convert(varchar,getdate(),7)  -- Mar 15, 18
SELECT convert(varchar,getdate(),8)  -- 10:39:39
SELECT convert(varchar,getdate(),9)  -- Mar 15 2018 10:39:48:373AM
SELECT convert(varchar,getdate(),10) -- 03-15-18
SELECT convert(varchar,getdate(),11) -- 18/03/15
SELECT convert(varchar,getdate(),15) -- 180315
SELECT convert(varchar,getdate(),13) -- 15 Mar 2018 10:41:07:590
SELECT convert(varchar,getdate(),14) -- 10:41:25:903
SELECT convert(varchar,getdate(),20) -- 2018-03-15 10:43:56
SELECT convert(varchar,getdate(),21) -- 2018-03-15 10:44:04.950
SELECT convert(varchar,getdate(),22) -- 03/15/18 10:44:50 AM
SELECT convert(varchar,getdate(),23) -- 2018-03-15
SELECT convert(varchar,getdate(),24) -- 10:45:45
SELECT convert(varchar,getdate(),25) -- 2018-03-15 10:46:11.263

-- T-SQL with century (YYYY or CCYY) datetime styles (formats)
SELECT convert(varchar, getdate(), 100) -- Oct 23 2016 10:22AM (or PM)
SELECT convert(varchar, getdate(), 101) -- 10/23/2016
SELECT convert(varchar, getdate(), 102) -- 2016.10.23
SELECT convert(varchar, getdate(), 103) -- 23/10/2016
SELECT convert(varchar, getdate(), 104) -- 23.10.2016
SELECT convert(varchar, getdate(), 105) -- 23-10-2016
SELECT convert(varchar, getdate(), 106) -- 23 Oct 2016
SELECT convert(varchar, getdate(), 107) -- Oct 23, 2016
SELECT convert(varchar, getdate(), 108) -- 09:10:34
SELECT convert(varchar, getdate(), 109) -- Oct 23 2016 11:10:33:993AM (or PM)
SELECT convert(varchar, getdate(), 110) -- 10-23-2016
SELECT convert(varchar, getdate(), 111) -- 2016/10/23
SELECT convert(varchar, getdate(), 112) -- 20161023
SELECT convert(varchar, getdate(), 113) -- 23 Oct 2016 06:10:55:383
SELECT convert(varchar, getdate(), 114) -- 06:10:55:383(24h)
SELECT convert(varchar, getdate(), 120) -- 2016-10-23 06:10:55(24h)
SELECT convert(varchar, getdate(), 121) -- 2016-10-23 06:10:55.383
SELECT convert(varchar, getdate(), 126) -- 2016-10-23T06:10:55.383
GO

Friday, September 20, 2013

Installing Android SDK on Windows: Complete Steps

         
         

                To begin with android apps development, you need to install the SDK and some other required components. Following are the steps one may follow to have the Android SDK installed in his/her system, although it is always advised that you should follow the instruction as per developer.android.com
  1. Download and install JDK if not installed already. [Download link] 
  2. Download and install Android SDK. [Download link]
  3. A pop-up will come out just after you finished installing the SDK, which is the SDK manager. If no pop-up window comes then you can manually open it from ‘All Program’.
  4. Download all or, required versions and components by checking them. For example, you can only check Android 2.2 and install it.
  5. Download & install eclipse. [Download link]n.b. :this is for 32 bit OS
  6. To Download and install ADT plugin for Eclipse -
    ->Start Eclipse, then select Help > Install New Software….
    ->Click Add, in the top-right corner.
    ->In the Add Repository dialog that appears, enter “ADT Plugin” for the Name and the following URL for the Location.   
    ->Click OK->Note: If you have trouble acquiring the plugin, try using “http” in the Location URL, instead of “https” (https is preferred for security reasons).
    ->In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
    ->In the next window, you’ll see a list of the tools to be downloaded. Click Next.
    ->Read and accept the license agreements, then click Finish.
    ->Note: If you get a security warning saying that the authenticity or validity of the software can’t be established, click OK. /> ->When the installation completes, restart Eclipse.
  7. Configuring Android SDK:
    ->After you’ve successfully downloaded the ADT as described above, the next step is to modify your ADT preferences in Eclipse to point to the Android SDK directory:Select Window > Preferences… to open the Preferences panel (Mac OS X: Eclipse > Preferences).
    Select Android from the left panel.
    ->You may see a dialog asking whether you want to send usage statistics to Google. If so, make your choice and click Proceed. You cannot continue with this procedure until you click Proceed.
    ->For the SDK Location in the main panel, click Browse… and locate your downloaded SDK directory.
    ->Click Apply, then OK.
    ->Done! If you haven’t encountered any problems, then the installation is complete