Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 27th, 2004, 05:12 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

the way I told works for every regional settings.
do you have any problem somewhere?can you provide me with more info?
(regional settings is assigned to the control globally,although you can
change it everywhere you need locally).
HtH.

--------------------------------------------
Mehdi.:)
 
Old August 28th, 2004, 03:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Hi Mehdi:
tnx for ur Mess & sorry for my delay! im pretty busy these days.

I knew {0:d}. but my date field came in string format like "830523" & I should mask it to 83/05/23.
thats why I asked here.
Tnx in advance.

& Dear Devon:
Regional Settings is a cliend side & its just a windows setting. it can NOT me my answer!

Always:),
Hovik Melkomian.
 
Old August 28th, 2004, 06:23 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Hovik,
IMO if you work with DateTime it would be much better
Have a look at this ...
Code:
DateTime dt=new DateTime(1382,2,28);
CultureInfo MyCulture =  new CultureInfo("fa-IR");//persian culture
TextBox1.Text=dt.ToString("yyyy/MM/dd",MyCulture);
although this culture wasnt installed in .NET properly!!!(it acts like en-US)
but as you see I use yyyy/MM/dd for my pattern to simulate persian date
correcly...
for format string you can change your string variable like below
Code:
string m="13820228";
m=m.Insert(4,"/");
m=m.Insert(7,"/");
TextBox1.Text=m;
anyway as you see its better to use DateTime ...
(your date field in your datasource should be as a datetime type
instead nvarchar or ...)
HtH.

--------------------------------------------
Mehdi.:)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert British format date to American format? fyr PHP How-To 0 December 19th, 2007 03:17 PM
date format differs, need to force format somehow patricolsson HTML Code Clinic 2 January 12th, 2006 05:55 AM
Date/Time format & multiple selection with listbox frmsasp ASP.NET 1.0 and 1.1 Basics 0 October 13th, 2005 05:50 AM
* where date >= '"& dateVar &"' order by date wrofox Classic ASP Databases 5 February 24th, 2005 10:11 AM
bindings & images miguel.ossa C# 1 August 20th, 2004 01:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.