Click here to Skip to main content
14,545,210 members
Rate this:
Please Sign up or sign in to vote.
See more:
when i use select command for datetime field,display value is system currentculture is 'fa-IR' and i use DateTime.Now for insert into database field.

What I have tried:

i use calender for convert datetime between persian and english calender.
Updated 21-May-20 0:47am
F-ES Sitecore 21-May-20 6:05am
As long as you keep the field as a date in SQL and a DateTime in .net then you can use the ToString method of your DateTime variable to show the date in your desired format, or if you are using a calendar component then there should be a property somewhere that allows you to set the desired format.
Maciej Los 21-May-20 8:21am
Show your code!

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

SQL databases actually store and treat DateTime values as numerical values.

How these are displayed is up to the individual SQL Client; it may inherit it from the Operating System or it may have it's own setting for it.
If you are using SQL Server Management Studio, the settings are located within
Tools > Options... > Environment > International Settings > Language

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100