473,387 Members | 1,455 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,387 software developers and data experts.

globalisation help (date times)

Hi
A problem has appeared in an app I am making. If the user has their clock
set to 12 hr format (i.e. am/pm) it breaks things as my app works in 24 hr
mode.

After some reading, I think the key to fixing this lies in globalisation...
I have amended the code as follows:

DateTime StartDatim;
DateTime EndDatim;
System.Globalization.DateTimeFormatInfo myDTFI = new
System.Globalization.CultureInfo("en-GB", false).DateTimeFormat;
myDTFI.FullDateTimePattern = "dd/MM/yyyy HH:mm:ss";
myDTFI.ShortTimePattern = "HH:mm:ss";
myDTFI.LongTimePattern = "HH:mm:ss";
StartDatim = DateTime.ParseExact(ApptDate + " " +
txtStartTime.Text,"dd/MM/yyyy HH:mm",myDTFI);
EndDatim = DateTime.ParseExact(ApptDate + " " + txtEndTime.Text,"dd/MM/yyyy
HH:mm", myDTFI);

If I get the app to halt at the last two lines, and my user has entered a
start time of 00:00 and an end time of 23:59, they are still being set in
the "StartDatim" and "EndDatim" objects as 12:00 and 11:59.
I thought the "big H" forces 24 hour, but I must be missing something, any
pointers?

Thanks
James.
Apr 10 '06 #1
0 986

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

Similar topics

2
by: Erik Johnson | last post by:
the following script... <?php $times = array( '2004-04-04 00:31:00-06', '2004-04-04 01:00:00-06', '2004-04-04 01:59:59-06', '2004-04-04 02:00:00-06', '2004-04-04 03:00:00-06',
4
by: p175 | last post by:
People, I'm trying to figure if SQL is able find sequences of transactions that occur over say a four day period. I have a table that contains a txn id and a date. Each transaction might...
6
by: Mark Reed | last post by:
Hi Guru's, I have created a database to monitor hours I have worked as our payroll department are so crap. I work nights most of the time but occasionally I have to work on days. Between the hours...
0
by: Jensen bredal | last post by:
Hello there, I need to implement globalisation in my asp.net app. I have chosen to use text files to contains my string and use ResGen.exe to build ressource dlls I have written the...
0
by: hazz | last post by:
I have introduced the following code into a business object to convert SQL Server datetime into a date format required for my client application....
2
by: x | last post by:
hi i am a pilot by profession. i want to create a database of my logbook using ms access 2002. i am facing a problem regarding the format of time field. when i select "Data/Time" data type for my...
7
by: No bother | last post by:
I have a table which has, among other fields, a date field. I want to get a count of records where certain criteria are met for, say, three days in a row. For example: NumWidgets Date...
6
by: Aussie Rules | last post by:
Hi, I have a datepicker that show a calender. The user picks a date and the time component is always 00:00. I then have a drop down that provides a list of times, (10:00, 11:00 etc), and I...
0
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.