Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Date Function

I have variables for year, month, day, and hour. Is there a date
function I can use to view the date as follows:

m/d/yyyy h:mm

DateFunction(year, month, day, hour)


---
Message posted from http://www.ExcelForum.com/

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

I think I can use this

CurrentDate = DateSerial(CurrentYear, CurrentMonth, CurrentDay)
CurrentHour / 2

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Date Function

ExcelMonkey,

DateSerial and TimeSerial
eg.

Sub test()
Dim lngYear As Long, lngMonth As Long, lngDay As Long, lngHour As Long
Dim dtm As Date

lngYear = 2004
lngMonth = 2
lngDay = 1
lngHour = 12

dtm = DateSerial(lngYear, lngMonth, lngDay) + TimeSerial(lngHour, 0, 0)

MsgBox Format(dtm, "dd-Mmm-yyyy HH:mm:ss")
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"ExcelMonkey " wrote in message
...
I have variables for year, month, day, and hour. Is there a date
function I can use to view the date as follows:

m/d/yyyy h:mm

DateFunction(year, month, day, hour)


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Date Function

One way:

myDate = DateSerial(year, month, day) + hour / 24
MsgBox Format(myDate, "m/d/yyyy h:mm")


In article ,
ExcelMonkey wrote:

I have variables for year, month, day, and hour. Is there a date
function I can use to view the date as follows:

m/d/yyyy h:mm

DateFunction(year, month, day, hour)


---
Message posted from http://www.ExcelForum.com/

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
Function to lookup date on tab in excel and populate date on calen MGC Excel Worksheet Functions 0 February 4th 10 04:48 AM
Difference betwen Excel Date () Function and System Date Khalil[_2_] Excel Worksheet Functions 2 June 16th 09 01:10 PM
SUMIF within date range as a function of today()'s date irvine79 Excel Worksheet Functions 8 August 6th 06 05:55 PM
Date Function formula that will return the date of a specific week Greg Excel Worksheet Functions 4 June 12th 06 05:07 PM
Calculating days between current date and a date in future NETWORKDAYS() function Faheem Khan Excel Worksheet Functions 2 February 10th 05 07:18 PM


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