473,399 Members | 3,656 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,399 software developers and data experts.

yyyy-mm-dd

is there an easy way of making a date appear in this
format:

yyyy-mm-dd

?

thank you
Nov 17 '05 #1
3 4713
RCS
string strFormattedDate = string.Format("{0:yyyy-MM-dd}",DateTime.Now);
string.Format takes [format and string literals], [params[] of variables]

And within the first format part, {0} refers to the first parameter.. so for
example:

string.Format("{0}, {1}, {0}, {2}", "Hello", "There", "You");

would result in:

Hello, There, Hello, You

Lastly, within the {0}, you can specify formatting things - like datatype,
precision and like above - the format. Do a search for string.Format to get
all the formatting rules..

HTH

"raisin" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
is there an easy way of making a date appear in this
format:

yyyy-mm-dd

?

thank you

Nov 17 '05 #2

"raisin" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
is there an easy way of making a date appear in this
format:

yyyy-mm-dd

?

thank you


Check your MSDN help for an article "Custom DateTime Format Strings".
There is a C# example at the end of the article.

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.
Nov 17 '05 #3
Thank you!!

:-)
Nov 17 '05 #4

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

Similar topics

7
by: teho | last post by:
Hello, I am new to PHP and I am wondering how can I set index.php to default url when accessing my site. Eg. http://www.yyyy.com/ will access the file http://www.yyyy.com/index.php. And how...
3
by: David | last post by:
Hi Group, i am trying to use the DatePart function on my SQL2000 database. I have a table called visitors with a field called DateTimeEntrance which is filled everytime a visitor enters the site....
4
by: Prakash | last post by:
Hi Can anyone tell me how to derive "yyyy" from a timestamp column in db2? Something like to_char(sysdate, 'yyyy') ... in oracle. I have to oracle-like to_char function but its very slow. If...
0
by: PMB | last post by:
Thank you in advance for any and all assistance. I would like to know how I can close out a Query/Table and Create a Table with the year? I want to be able to create a table with saved data and...
1
by: Rob | last post by:
How can I create a validation rule for only allowing two specific dates but with variable years: 1/1/yyyy or 12/1/yyyy so only the dates 1/1/2004 or 1/1/1999 or 12/1/2001 etc. I tried...
3
by: Lee Chapman | last post by:
Hi, I have a problem where my ASP.NET application occasionally generates a MissingFieldException exception. This unexpectedly happened on my development box, and so I was able to extract some...
6
by: DavidOwens | last post by:
Sub PreviewReport_Click() On Error GoTo Err_PreviewReport_Click Dim stRepName As String: Rem Holds the Report name Dim stDispId As String: Rem Holds the Dispenser ID Dim...
3
by: Michael R | last post by:
Hello dear users and experts: In my current project I have a cross-tab query, with a row heading column being a date. I'm intersted for it to be sorted correctly, and it is: 04/2003, 05/2003,...
1
by: ambi21hs | last post by:
Hi i need a validation code in c for month in the mon-yyyy format 2 embed in between sql so any one help me out with this.. thank you
0
by: JB | last post by:
I am getting the above error message. I have an abstract class which defines a method like so: public abstract IContainer NewDal { get; } - Then I have a class which is implementing the...
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?
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
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
Oralloy
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,...
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...
0
tracyyun
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...
0
agi2029
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,...
0
isladogs
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...

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.