codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Format Date time issue....  asp monkey at 13:23 on Tuesday, January 11, 2005
 

Hi all hope someone out there can help me

This is my code...

Response.write FormatDateTime(Now,vbLongDate)

but what im getting is 10 January 2005 instead of Tuesday 10 January 2005

Any Ideas?


  Re: Format Date time issue....  tgreer at 17:18 on Tuesday, January 11, 2005
 

You can use a DateTime overload of the ToString() method to specify the format. The particular format you've requested is not one of the built-in formats, you'll have to build that yourself by calling the various methods (Day, Week, etc.) of the DateTime object.

If you want to use one of the built-in formats:

DateTime dt = DateTime.Now;
String date;
date = dt.ToString("D", DateTimeFormatInfo.InvariantInfo);

MSDN article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDateTimeClassToStringTopic.asp


If you always want to format your date a certain way, you need to look at the "Locale" functions of the .NET platform.

Regards,
Thomas D. Greer
www.tgreer.com

If this post helped you, please keep in mind that CodeToad is advertiser supported, as is my personal site.










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Questions about web user control in ASP.NET
•  Re: XML- Passing parameters are Latitude and Longitude.
•  Layer filter called by Javascript
•  Re: replication
•  Re: Format Date time issue....
•  Re: How to freeze the web page when displaying progress bar?
•  Re: Help! IFrames!
•  Re: Help: Trouble with z-Index and SELECT lists
•  Re: HOW CREATE LINE CHARTS IN ASP.NET


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005