Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default 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
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
Need to convert Minutes:Seconds format to minutes with seconds con Cliff Excel Worksheet Functions 3 June 18th 09 05:22 AM
How do I change a minutes and seconds as a 2400 time to seconds? NickBrown419 Excel Worksheet Functions 1 August 10th 08 09:12 PM
Entering Seconds but displaying minutes & seconds DaveWHAC Excel Discussion (Misc queries) 7 October 20th 06 02:14 PM
Formula to Change Hours:Minutes:Seconds to Seconds only Cheri Excel Discussion (Misc queries) 4 August 30th 06 12:44 AM
Convert "Time Interval" in "hours : minutes : seconds" to seconds Ianukotnorth New Users to Excel 7 May 8th 05 08:11 PM


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

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

About Us

"It's about Microsoft Excel"