#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Date type

Hi All,

How I can change the date type from
dd/mm/yyyy hh:mm:ss to [hh]:mm:ss

Thanks & Regards

Hassan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 182
Default Date type

For example:
sub test()
Yourdate = 01/12/2007 22:00:01
YourHour = Format(Yourdate,"hh:mm:ss")
msgbox Yourdate
End sub
--
Regards,

Halim



"Hassan" wrote:

Hi All,

How I can change the date type from
dd/mm/yyyy hh:mm:ss to [hh]:mm:ss

Thanks & Regards

Hassan

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 417
Default Date type

I think it would be better to add a "Time" style to your workbook,
instead of re-defining the "Date" style. Changing the style would be
confusing to other users, if you forward the workbook to them.

To add a new style to your workbook (instructions for Excel 2000):

1. Choose the Style command from the Format menu.
2. Type in "Time" in the "Style name" combo box.
3. Uncheck all of the checkboxes except "Number".
4. Click the Add button.
5. Click the Modify button to display the Format Cells dialog box, then
choose "Time" in the Category list box, and one of the time formats in
the Type list box.
6. Click OK in the Format Cells dialog box.
7. Click Close or OK in the Style dialog box.

Use this "Time" style to format all of the cells you want. If you don't
have the style combo box displayed on your Formatting toolbar, add it by
using the Customize feature. (Microsoft started leaving the Style box
off of the toolbar with Excel 2000. I don't know if they have added it
back in more recent versions or not. Maybe Styles have even gone away in
the latest version!)
--
Regards,
Bill Renaud



Reply
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
My date is coming up 0-Jan-00 when I type current date. Why? Clark Excel Discussion (Misc queries) 5 January 5th 10 05:59 PM
This date 20071017072917 into this type of date 10/17/2007 29:17 Micro Excel Discussion (Misc queries) 3 October 17th 07 05:58 PM
how to convert date type to text type Steffen Excel Discussion (Misc queries) 3 July 17th 07 11:32 AM
How do you add one date to another? I type in 1/31/05 in A1 and I. JPreeshl Excel Worksheet Functions 2 February 23rd 05 01:03 AM
Why can't I type in a date? No Spam Please Excel Discussion (Misc queries) 4 December 10th 04 12:20 AM


All times are GMT +1. The time now is 12:02 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"