Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
minutes & seconds functions
Does VBA have any built in functions that test if a
string is properly formatted in minutes and seconds notation such as: mm:ss??? For example, if the function is given a string value of "1:22" or "0:22" or ":45", then the function should return TRUE! However, the function would return false if it was given strings such as: "6a:20" or "hello" etc... thnx |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
minutes & seconds functions
Use the IsDate function
However, you'll note that ":45" is not considered a valid date. Sub test() Debug.Print IsDate("1:22") Debug.Print IsDate("0:22") Debug.Print IsDate(":45") Debug.Print IsDate("6a:20") Debug.Print IsDate("hello") End Sub Cheers, Rob On 13-Dec-2009 14:39, Robert Crandal wrote: Does VBA have any built in functions that test if a string is properly formatted in minutes and seconds notation such as: mm:ss??? For example, if the function is given a string value of "1:22" or "0:22" or ":45", then the function should return TRUE! However, the function would return false if it was given strings such as: "6a:20" or "hello" etc... thnx |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
minutes & seconds functions
Are there a family of functions related to "IsDate" which
extract minutes and seconds??? For example: GetMinutes("22:42") == would return "22" GetSeconds("13:01") == would return "01" "Rob van Gelder" wrote in message ... Use the IsDate function However, you'll note that ":45" is not considered a valid date. Sub test() Debug.Print IsDate("1:22") Debug.Print IsDate("0:22") Debug.Print IsDate(":45") Debug.Print IsDate("6a:20") Debug.Print IsDate("hello") End Sub Cheers, Rob |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
minutes & seconds functions
Sub test()
Debug.Print Minute("00:22:42") Debug.Print Second("00:13:01") End Sub note that 22:42 would be interpreted as 10pm, not 22 minutes. On 13-Dec-2009 16:54, Robert Crandal wrote: Are there a family of functions related to "IsDate" which extract minutes and seconds??? For example: GetMinutes("22:42") == would return "22" GetSeconds("13:01") == would return "01" "Rob van Gelder" wrote in message ... Use the IsDate function However, you'll note that ":45" is not considered a valid date. Sub test() Debug.Print IsDate("1:22") Debug.Print IsDate("0:22") Debug.Print IsDate(":45") Debug.Print IsDate("6a:20") Debug.Print IsDate("hello") End Sub Cheers, Rob |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need to convert Minutes:Seconds format to minutes with seconds con | Excel Worksheet Functions | |||
How do I change a minutes and seconds as a 2400 time to seconds? | Excel Worksheet Functions | |||
Entering Seconds but displaying minutes & seconds | Excel Discussion (Misc queries) | |||
Formula to Change Hours:Minutes:Seconds to Seconds only | Excel Discussion (Misc queries) | |||
Convert "Time Interval" in "hours : minutes : seconds" to seconds | New Users to Excel |