SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Datetime field
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sunny_10
Yak Posting Veteran

65 Posts

Posted - 03/07/2013 :  05:42:04  Show Profile  Reply with Quote
Hi

I have datetime field . Regional Settings is MM/dd/yyyy. In which format date will be stored in Database

Thanks

rjhe22
Constraint Violating Yak Guru

251 Posts

Posted - 03/07/2013 :  05:53:57  Show Profile  Reply with Quote
probably yyyy/mm/dd all mine do
Go to Top of Page

sunny_10
Yak Posting Veteran

65 Posts

Posted - 03/07/2013 :  06:07:07  Show Profile  Reply with Quote
Hi

When i insert record i gave written this
Format(DTPicker3.Value, "MM/dd/yyyy") . On what basis date is stored in Database.

Thanks
Go to Top of Page

MIK_2008
Flowing Fount of Yak Knowledge

Pakistan
1052 Posts

Posted - 03/07/2013 :  06:16:55  Show Profile  Reply with Quote
In which database are you going to store? .. If SQL server then check the default format by executing

SELECT getdate()

You'll find the format in which SQL server stored date datatype value in a field.

Cheers
MIK
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 03/07/2013 :  06:22:05  Show Profile  Reply with Quote
quote:
Originally posted by sunny_10

Hi

When i insert record i gave written this
Format(DTPicker3.Value, "MM/dd/yyyy") . On what basis date is stored in Database.

Thanks


dates are stored in sql server internally as integer values. when you select datetime field the values will be shown in iso format yyyy-mm-dd hh:mi:ss
You can apply CONVERT() function to get it in format you want by making it varchar and specifying a style value which corresponds to format. This can also be done in front end applications using format functions available there.

See below links for more info

http://visakhm.blogspot.in/2012/07/generate-datetime-values-from-integers.html

http://visakhm.blogspot.in/2011/12/why-iso-format-is-recommended-while.html

http://msdn.microsoft.com/en-IN/library/ms187928.aspx



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000