473,388 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

convert date

if I convert dt with this function:

dt = DateTime.ParseExact(string, "dd.MM.yyyy h:mm:ss",
System.Globalization.CultureInfo.CurrentCulture)

I get as a result:

dt =#12/24/2003 10:00:00 PM#

but I would like to get without PM and AM:

dt= #12/24/2003 22:00:00#
or in fact:
dt= #24.12.2003 22:00:00#

How can I set that, change the
System.Globalization.CultureInfo.CurrentCulture?

Thank you,
Simon
Nov 18 '05 #1
2 1024
"simon" <si*********@stud-moderna.si> wrote in message
news:uH**************@tk2msftngp13.phx.gbl
if I convert dt with this function:

dt = DateTime.ParseExact(string, "dd.MM.yyyy h:mm:ss",
System.Globalization.CultureInfo.CurrentCulture)

I get as a result:

dt =#12/24/2003 10:00:00 PM#

but I would like to get without PM and AM:

dt= #12/24/2003 22:00:00#
or in fact:
dt= #24.12.2003 22:00:00#


How are you examing dt? It sounds like you are simply seeing the default
date/time display format on your system. Try
dt.ToString("dd.MM.yyyy h:mm:ss")

--
C# newbie... posts are probably inaccurate, inelegant or both!

Nov 18 '05 #2
The default date-time format is what I would like to get.
My default (in windows) is: 24.12.2003 22:00:00

But with System.Globalization.CultureInfo.CurrentCulture I get american
values, also in my activeX:dateTimePicker I also get american values. I
would like to change it but I don't know where?

Thank you for your answer,
Simon

"Bill Styles" <no*****@nowhere.com> wrote in message
news:Oo**************@TK2MSFTNGP10.phx.gbl...
"simon" <si*********@stud-moderna.si> wrote in message
news:uH**************@tk2msftngp13.phx.gbl
if I convert dt with this function:

dt = DateTime.ParseExact(string, "dd.MM.yyyy h:mm:ss",
System.Globalization.CultureInfo.CurrentCulture)

I get as a result:

dt =#12/24/2003 10:00:00 PM#

but I would like to get without PM and AM:

dt= #12/24/2003 22:00:00#
or in fact:
dt= #24.12.2003 22:00:00#


How are you examing dt? It sounds like you are simply seeing the default
date/time display format on your system. Try
dt.ToString("dd.MM.yyyy h:mm:ss")

--
C# newbie... posts are probably inaccurate, inelegant or both!

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Loi Tan Vo | last post by:
Hi, I have a text file that contains a date column. The text file will be imported to database in SQL 2000 server. After to be imported, I want to convert the date column to date type. For...
19
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below....
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
1
by: Matt | last post by:
I would like to convert a couple informix stored procedures to SQL Server stored procedures. I have no idea how to accomplish this. Here is an example of one of the procedures I need to convert. ...
3
by: jerry.ranch | last post by:
I have a need to convert simple dates (i.e. 02/14/2005) to a number, do some math, and convert back to a date. (in a simple query). The math involves adding or substracting days, and days of the...
2
by: Franck | last post by:
Hi, 'm gettin mad about date conversion. Here is the point. Got and add-in for Excel which call functions from a web service (on a remote server) The remote server has regional settings...
1
by: abcabcabc | last post by:
I write an application which can let user define own date format to input, How to convert the date string to date value with end-user defined date format? Example, User Defined Date Format as...
17
by: Terry Jolly | last post by:
New to C# ---- How do I convert a Date to int? In VB6: Dim lDate as long lDate = CLng(Date) In C#
4
by: perryclisbee via AccessMonster.com | last post by:
I have dates of service for several people that range all over each month. ie: patient had dates of service of: 7/3/2006, 7/24/2006 and 7/25/2006. I need to create a new field via a query that...
8
by: deepak_kamath_n | last post by:
Hello, I have the following scenario: 1. My application receives the date from another application as a string 2. The other application is running in a different time zone as compared to my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.