Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Suppose I have the following string variable:
s = "10:20 PM" Is there a function that will convert s to military like so?: s = "2200" ' Now represents military time -Robert |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"RG III" wrote in message
Suppose I have the following string variable: s = "10:20 PM" Is there a function that will convert s to military like so?: s = "2200" ' Now represents military time -Robert There's no builtin function but easy enough to roll your own. But why not simply number-format the cell(s) with "hhmm" Peter T |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Wednesday, September 25, 2019 at 8:31:31 AM UTC-7, Peter T wrote:
There's no builtin function but easy enough to roll your own. But why not simply number-format the cell(s) with "hhmm The data is not stored in a cell. I was just trying to find a method to convert time strings stored in variables. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Am Wed, 25 Sep 2019 11:06:07 -0700 (PDT) schrieb RG III: The data is not stored in a cell. I was just trying to find a method to convert time strings stored in variables. try: s = "10:20 PM" t = TimeValue(s) s = Hour(t) & Minute(t) Regards Claus B. -- Windows10 Office 2016 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Wednesday, September 25, 2019 at 11:20:51 AM UTC-7, Claus Busch wrote:
s = "10:20 PM" t = TimeValue(s) s = Hour(t) & Minute(t) Those functions are a big help. The only problem is if the input is something like this: s = "10:04 PM" ' Output == "224" I guess if the minutes value is less than 10, I just need to prefix the minutes with a "0" |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Am Wed, 25 Sep 2019 11:37:31 -0700 (PDT) schrieb RG III: The only problem is if the input is something like this: s = "10:04 PM" ' Output == "224" then try: s = "10:04 PM" t = TimeValue(s) s = Format(Hour(t), "00") & Format(Minute(t), "00") Regards Claus B. -- Windows10 Office 2016 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Time Conversion | Excel Worksheet Functions | |||
time conversion | Excel Worksheet Functions | |||
Time Conversion | Excel Discussion (Misc queries) | |||
time conversion | Excel Programming | |||
TIME CONVERSION | Excel Programming |