Hi,
I'm trying to enter the time in the following format:
HH:MM:SS AM/PM
e.g. 05:33:21 PM
How can i achieve this from the Date Time object?
DateTime.Now.To String("?");
I've search MSDN, and they only seem to cater for the 24 hour clock,
not the 12 hour clock
In the meanwhile, i strip the date by using DateTime.Now.Ho ur.
and then based on if it's greater than 12.
There must be a simpler built in way
TIA 4 23936
Good evening,
DateTime.Now.To String("hh:mm:s s tt")
Regards
--
Milosz
"Grant Merwitz" wrote:
Hi,
I'm trying to enter the time in the following format:
HH:MM:SS AM/PM
e.g. 05:33:21 PM
How can i achieve this from the Date Time object?
DateTime.Now.To String("?");
I've search MSDN, and they only seem to cater for the 24 hour clock,
not the 12 hour clock
In the meanwhile, i strip the date by using DateTime.Now.Ho ur.
and then based on if it's greater than 12.
There must be a simpler built in way
TIA
On Thu, 29 Mar 2007 17:58:25 +0200, Grant Merwitz wrote:
Hi,
I'm trying to enter the time in the following format:
HH:MM:SS AM/PM
e.g. 05:33:21 PM
How can i achieve this from the Date Time object?
DateTime.Now.To String("?");
I've search MSDN, and they only seem to cater for the 24 hour clock,
not the 12 hour clock
In the meanwhile, i strip the date by using DateTime.Now.Ho ur.
and then based on if it's greater than 12.
There must be a simpler built in way
TIA
DateTime.Now.To String("hh:mm tt")
--
Bits.Bytes http://bytes.thinkersroom.com
thanks,
i don't know why i couldn't find that on MSDN
"Milosz Skalecki [MCAD]" <mi*****@DONTLI KESPAMwp.plwrot e in message
news:2E******** *************** ***********@mic rosoft.com...
Good evening,
DateTime.Now.To String("hh:mm:s s tt")
Regards
--
Milosz
"Grant Merwitz" wrote:
>Hi,
I'm trying to enter the time in the following format: HH:MM:SS AM/PM
e.g. 05:33:21 PM
How can i achieve this from the Date Time object?
DateTime.Now.To String("?");
I've search MSDN, and they only seem to cater for the 24 hour clock, not the 12 hour clock
In the meanwhile, i strip the date by using DateTime.Now.Ho ur. and then based on if it's greater than 12.
There must be a simpler built in way
TIA
"Rad [Visual C# MVP]" <no****@nospam. comwrote in message
news:11******** ********@thinke rsroom.com...
On Thu, 29 Mar 2007 17:58:25 +0200, Grant Merwitz wrote:
>Hi,
I'm trying to enter the time in the following format: HH:MM:SS AM/PM
e.g. 05:33:21 PM
How can i achieve this from the Date Time object?
DateTime.Now.To String("?");
I've search MSDN, and they only seem to cater for the 24 hour clock, not the 12 hour clock
In the meanwhile, i strip the date by using DateTime.Now.Ho ur. and then based on if it's greater than 12.
There must be a simpler built in way
TIA
DateTime.Now.To String("hh:mm tt")
--
thanks,
i don't know why i couldn't find that on MSDN This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: MGRIDEOUT |
last post by:
Hello ,
I have a sub that gets all records in a table. Then displays the
times in a drop-down list (ddlStartTime). My problem is that the ddl contain
the date AND time. i.e. 9:00 AM in the table is 1/1/1899 9:00:00 AM in the
ddl.
How do I get JUST the Time in format 9:00 AM??
Please I have been at this now for over 2 days and I can't seem to get
|
by: PK9 |
last post by:
I have a string variable that holds the equivalent of a DateTime value. I
pulled this datetime from the database and I want to strip off the time
portion before displaying to the user.
I am using C#
eg.
- String variable "strMyDate" holds the value "1/1/2005 12:00:00 AM" from
the database.
- I do not care about the time portion, I only want "1/1/2005" for display.
|
by: Fritz Switzer |
last post by:
I'd like to have a string assigned the value of a
DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM"
format.
For example:
DateTime.Now.AddMinutes(30) returns "00:30"
DateTime.Now.AddMinutes(90) returns "1:30" or "01:30"
|
by: Hans Merkl |
last post by:
Does anybody know of a library that can handle strings pf various formats
and conver them to a DateTime value? The strings are coming from a webform
and I can't restrict the input (it's not my form).
I have been using Convert.ToDateTime but it choked on "12:00 noon".
I am looking for a function that can make sense out of anything that looks
like a date/time. Outlook is pretty good at it when you enter an
appointment with the GUI, but...
|
by: Andrew S. Giles |
last post by:
Hello,
I am importing a flat text file, and putting it into a datagrid for display
on a form.
Currently the users have their dates and times seperated. I have two
fields, therefore in the datatable feeding the datagrid control. Both are of
the DateTime Type. How do I get the time field to display only the Time, and
not the date, which is apparently the default.
| |
by: Reny J Joseph Thuthikattu |
last post by:
Hi,
I have a variabe in the format of 'DD-MON-YYYY HH:MI AM' .I want to add a
miniute to it.How can i do that?
by manipulation i want to make '01-JUNE-2004 11:59 PM' to '02-JUNE-2004
12:00 AM'
How do i do that?
Reny
---
|
by: Cor Ligthert |
last post by:
Hello everybody,
Jay and Herfried are telling me every time when I use CDate that using the
datetime.parseexact is always the best way to do String to datetime
conversions. They don't tell why only that I have to listen to them because
they know it better.
They told also that in a business situation it is better to use
datetime.parseexact for changing cultures and not to use the globalization
setting. I did not give them this sample,...
|
by: Simon Harvey |
last post by:
Hi all,
I'm having a bit of a problem working with dates. My computer is british,
but I'm developing an american application so I therefore need to use american
dates. But I can't get my DateTime object to "act" american.
Let me give an example:
In order to take in an american date, I tell it which culture the date will
be formatted according to:
|
by: Greg Collins [Microsoft MVP] |
last post by:
Will DateTime.Now.ToString("s") ALWAYS return the same formatting (i.e. the sortable XML Schema style formatting) regardless of what culture the operating system is set to?
I've done limited testing to show that this is the case when switching to the Italian culture, but I need to verify that in EVERY culture setting it will ALWAYS return the same format.
Thanks.
--
Greg Collins
Visit Brain Trove ( http://www.BrainTrove.com )
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |