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 23935
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: 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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: 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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |