Link to home
Start Free TrialLog in
Avatar of RadhaKrishnaKiJaya
RadhaKrishnaKiJaya

asked on

Need help with a query

Hi Experts,

I want to get the date in  'mmddyyyy'  format  the CURRENT_TIMESTAMP . I have an insert statement. The date '08042016' should come from the CURRENT_TIMESTAMP .

Thanks in advance.

INSERT INTO LOGINDETAILS
            ( UserID,              
            StdTimeIn,
                TodaysDate    
          )
     VALUES
                ( 1,                                    
                  CURRENT_TIMESTAMP,
                  '08042016'                        
          )
Avatar of vvk
vvk

using convert function with style 12 shall give format you want, something like convert(nvarchar(8),getdate(),12)
Avatar of RadhaKrishnaKiJaya

ASKER

Hi,

Thank you for your reply. With convert(nvarchar(8),getdate(),12)  I am getting '160804 '. but I need '08042016'

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Dustin Saunders
Dustin Saunders
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks. It worked!!