Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Date Equation Format

Author  Topic 

yatesy87
Starting Member

8 Posts

Posted - 2006-03-01 : 11:11:36
I seem to have ran into a problem

Basically what my ASP webpage does is inserts the date/time into the database with the format mm/dd/yyyy which obviously as I am living in the UK I do not want I want it to be dd/mm/yyyy. The reason for this is later on I need to do a equation where by the equation takes 6 months of the current date and then references it against the database date.

How will I tell the database to make it dd/mm/yyy or is their another way around it?

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-03-01 : 11:30:24
1. u can store ur date in either format
2. U can do the comparison in the frontend regardless of the format (u can convert to any format using front end functions - eg. in ASP its FORMAT(...)
3. U can do the comparison in database (may be in a stored procedure - doesn't matter of the format - if u want u can format to any format that u need)

If u want to do the comparison in SQL Server, Refer
- Convert function
- Date related functions as DateDiff, DateAdd ...
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-03-01 : 13:23:13
If you are using the datetime datatype in SQL, then the date is not stored in ANY format. It is just stored as a value.

the same applies to passing data to SQL from ASP -- if you use proper datetime parameters, then you are using VALUES and formatting is not an issue.

Formatting is only a problem if you are using improper datatypes or not using parameters correctly.
Go to Top of Page
   

- Advertisement -