LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Convert the date to day of the week.

On Sun, 23 Mar 2008 07:52:00 -0700, Nils Titley
wrote:

Ron,

I am not sure this is helping....

I changed what you have because I don't have #2/12/2008# I have "02/12/2008".


If you did that, in the CONST line, you would have gotten a "type mismatch"
error. So I don't understand what you mean here or what you did.


When I do that I get debug print
A) 02/12/2008 = 39490 120208 (ddmmyy)
B) 12/02/2008 = 39784 021208 (ddmmyy)

A) ActiveCell.Offset(0, 17).Value = Format(CLng(dt), "ddmmyy")
B) ActiveCell.Offset(0, 18).Value = Format(CLng(dt2), "ddmmyy")
Results
A) 120208
B) 21208

I tried, what I call casting, RunDate(MyNum) as
CLng(RunDate(MyNum))


I'm not familiar with your term "casting" in this context. So again, I don't
understand what you mean.


ActiveCell.Offset(0, 0).Value = Format(CLng(RunDate(MyNum)), "ddmmyy")
Data = 12/02/2008
Result = 21208
Expecte as above 120208

Please, I don't get it and don't know what to do.

Thanks


Let me repeat: "Excel stores dates as serial numbers"

If you have a value, expressed as a serial number, of 21208 (or 021208), and
then try to express that as a date, it will translate to be 21,208 days after 1
Jan 1900, or Thursday, January 23, 1958.

You still haven't indicated what your RunDate function is doing, or what MyNum
is.

Also, perhaps you do not understand the formatting a cell as a date has
AABSOLUTELY NOTHING TO DO with how Excel interprets the value in that cell. It
only determines how the value in that cell is displayed.

Excel interprets date input according to the settings/format in the REGIONAL
AND LANGUAGE settings (in Control Panel). Usually, that format defines the
order (dmy, mdy, etc) as well as the separator (usually a "/").

If your data input does not conform to these specifications (i.e. if your data
is 120208 instead of 12/02/08), you will need to manipulate the data in order
to correct this.

If you could answer the questions I've posed, it should be possible to help.
--ron
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert regular Date to Week Ending or Week Beginning Dates Sam H Excel Discussion (Misc queries) 5 April 3rd 23 04:39 PM
How do I convert a date to Monday's date within its week? Sorsy Excel Worksheet Functions 7 October 9th 08 06:48 PM
Convert Week Number to Date valerie Excel Discussion (Misc queries) 1 April 18th 08 10:32 PM
How do I convert a date to a week of the year? JBTexas Excel Discussion (Misc queries) 12 September 5th 07 10:14 PM
How can I convert a date into a week number... msbutton27 Excel Worksheet Functions 7 May 25th 05 09:44 PM


All times are GMT +1. The time now is 06:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"