laurin1 Posted December 21, 2004 Share Posted December 21, 2004 Can someone help me figure out how to convert a date/time to seconds? Keith Davis MCSA, ZCE, A+, N+ http://www.laurinkeithdavis.com Link to comment Share on other sites More sharing options...
MHz Posted December 21, 2004 Share Posted December 21, 2004 You can copy the UDF from here.Just a small sample to use, with the included UDF$sType='s' $sStartDate='2004/12/01 12:00:00' $sEndDate='2004/12/01 12:01:00' $ans= _DateDiff($sType, $sStartDate, $sEndDate) MsgBox(0, 'Seconds', 'Equals ' & $ans) Link to comment Share on other sites More sharing options...
laurin1 Posted December 21, 2004 Author Share Posted December 21, 2004 You can copy the UDF from here.Just a small sample to use, with the included UDF$sType='s' $sStartDate='2004/12/01 12:00:00' $sEndDate='2004/12/01 12:01:00' $ans= _DateDiff($sType, $sStartDate, $sEndDate) MsgBox(0, 'Seconds', 'Equals ' & $ans)<{POST_SNAPBACK}>I don't understand. When I run your sample, the answer is 60. I want to take a date and convert it into seconds. Keith Davis MCSA, ZCE, A+, N+ http://www.laurinkeithdavis.com Link to comment Share on other sites More sharing options...
MHz Posted December 21, 2004 Share Posted December 21, 2004 $sType is the variable for hours, minutes or seconds selection. $sStartDate is the variable for Start Date. $sEndDate is the variable for Finish Date. $ans is the result of into the UDF script to create the difference in seconds, between the 2 dates. The 60 returned is 60 seconds. This gives you date/time difference in seconds? Could you express more, if insuffient. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 21, 2004 Developers Share Posted December 21, 2004 I don't understand. When I run your sample, the answer is 60. I want to take a date and convert it into seconds.<{POST_SNAPBACK}>You will need a start date to determine the number of seconds elapsed since...The Date functions currently only accept a date between 1900 - 2999 . SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
laurin1 Posted December 21, 2004 Author Share Posted December 21, 2004 You will need a start date to determine the number of seconds elapsed since...The Date functions currently only accept a date between 1900 - 2999 .<{POST_SNAPBACK}>Oh, yea. Duh. Keith Davis MCSA, ZCE, A+, N+ http://www.laurinkeithdavis.com Link to comment Share on other sites More sharing options...
MHz Posted December 21, 2004 Share Posted December 21, 2004 This is the area of interest in the UDF; Description: Returns the difference between 2 dates, expressed in the type requested; Parameter(s): $sType - returns the difference in:; d = days; m = Months; y = Years; w = Weeks; h = Hours; n = Minutes; s = Seconds; $sStartDate - Input Start date in the format "YYYY/MM/DD[ HH:MM:SS]"; $sEndDate - Input End date in the format "YYYY/MM/DD[ HH:MM:SS]"; Requirement(s): None; Return Value(s): On Success - Difference between the 2 dates; On Failure - 0 and Set; @ERROR to: 1 - Invalid $sType; 2 - Invalid $sStartDate; 3 - Invalid $sEndDate; Author(s): Jos van der ZandeJdeB coded it, btw. Link to comment Share on other sites More sharing options...
the_lord_mephy Posted December 22, 2004 Share Posted December 22, 2004 I don't understand how you can convert a Date into seconds. maybe Time, but date from when? My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote] Link to comment Share on other sites More sharing options...
Valik Posted December 22, 2004 Share Posted December 22, 2004 (edited) Read the thread, that was answered. Edit: The common epoch is January 1, 1970 00:00:00 GMT. Edited December 22, 2004 by Valik Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now