time,smallbasic , Small Basic - How to check if a date is passed?


Small Basic - How to check if a date is passed?

Question:

Tag: time,smallbasic

I'm trying to make a license verification that should expire in a week with small basic. I could make a script that would write down the day the license was activated and that would expire the license as soon as the current day is 7 larger than the written amount. The problem is that if you'd activate the license on 28/any month, the license wouldn't expire since the current day would never be 35/any month. Is there a way to make small basic check if a date has been passed without making a script with about 100 If-Then's?


Answer:

In gross terms, you need a date based upon an epoch, not the day of the month.

IOW, count the number of days since an event, store that value, when the current date is 7 days after the original date, expire.

http://litdev.co.uk/ offers a smallbasic library that provides this functionality if you don't want to roll your own.


Related:


Android: Time Loop in milliseconds


android,android-activity,time
This game is similar to one of those where your try to survive for as long as possible, like those hell-shooter games. So basically I wish to record to amount of time the user can survive after pressing "start". Similarly, I would like to continue to update the frames at...

Small Basic - How to check if a date is passed?


time,smallbasic
I'm trying to make a license verification that should expire in a week with small basic. I could make a script that would write down the day the license was activated and that would expire the license as soon as the current day is 7 larger than the written amount....

display message if time difference is greater than 50 minutes - php


php,datetime,time
Basically i'm getting time difference between current time and database time. $cur_time = time(); $db_time = $rs[$k]['update_time']; $diff = abs($cur_time - $db_time); $months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); $days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); $hours = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24...

Why is Array.splice() so slow?


javascript,arrays,performance,time
I recently saw this benchmark: http://jsperf.com/remove-element-splice-vs-move-and-pop I noticed that Array.splice() is several orders of magnitude slower than a for loop iterating through the elements. This lead me to wonder why Array.splice() is so slow. Therefore, I came here to ask you: Why is Array.splice() so slow?...

How can I extract only hours and minutes in the format HH:MM from a HH:MM:SS time string?


php,string,date,time
I'm getting the time in this format: 0:18:32 If I do var_dump() I get: string '0:18:32:���' (length=11) The time is saved in my DB as 18:32:00. I want to get HH:MM out of this and I've tried the following code, but it doesn't work as expected. $AdmissionTime = strftime("%H:%M" ,$patient['TIME_UNIT_ADM']...

time formatting in matlab


matlab,time,format
I have time series per minute that look as shown below. The format is like '"hh:mm"' as seen below '"8:59"' '"9:00"' '"9:01"' '"9:02"' '"9:03"' '"9:04"' '"9:05"' '"9:06"' '"9:07"' Is it possible to change these to hhmm format in matlab like 859 900 901 902 t0 a double format. ...

Android: automatic logout


java,android,time,login,logout
Hi I want to logout automatically after a determined time of inactivity my Android app. In the Second Activity in onPause I save the time when the app is in pause in a variable. In MainActivity in method onresume I save the time when the app restarts in another variable...

Show a timer in a Java Frame


java,time
I want to show the elapsed time of a game i'm doing. Basically i want to call the class that keeps track of the score and with calling the class i want to start a timer that just continually runs and shows the elapsed time, this should be added. Is...

Android - At Minutes to a Time hh.mm.ss


java,android,date,time
i,ve got a problem which i cant solve at the moment. I already googled for it and found some solutions, but all of them not rly match my problem. So i get 2 Strings from SQL Database in the format hh:mm:ss. The first String is a time, for example "14:30:00"...

PLSQL Need REFCURSOR DATE + TIME


date,time,plsql,cursor
im using this code and I had 1 problem, the o_besteltijden cursor has this as output: 01-06-15 ( a date), but I prefer output like: 16:00 (so only time) Or 01-06-15 16:00:00 (date + time). is that possible? SET SERVEROUTPUT ON; CREATE OR REPLACE TYPE t_openingstijd IS TABLE OF DATE;...

Convert double to time_t


c++,time,standards,chrono,time-t
I have a double containing seconds. I would like to convert this into a time_t. I can't find a standard function which accomplishes this. Do I have to fill out the time_t by hand?...

How to Minus time with python


python,time
I'd like to get the time before X seconds before datetime.time.now(). For example if the time.now() is 12:59:00 so If I minus 59, I want to get 12:00:00. I can't find a way to do that. Any help will be appreciated....

PHP Timezone not working correctly


php,date,time,timezone
So we have in-house servers here in this EDT part of the USA America/New_York and for someone reason, this [SSCCE][1] code is not working. <?php echo date_default_timezone_get() . " <br />"; $dateCal = "2015-06-22 13:00:00"; // EDT Time $schedule_date = new DateTime($dateCal, new DateTimeZone("America/Chicago") ); echo $dateCal . " <br...

jQuery: Clear input field if it is not filled in certain time? [closed]


javascript,jquery,input,time
Using jquery or js, how can I clear an input field if it doesn't reach x amount of characters in a certain time? Basically, if an input field doesn't reach 10 characters in 1 second, I want to clear any input that was typed. How can I calculate the time...

Why this while loop cannot print 1,000 times per seconds?


java,loops,time,while-loop
The following Java method is meant to print the number i by nLoopsPerSecond times per second for seconds seconds: public void test(int nLoopsPerSecond, int seconds) { double secondsPerLoop = 1.0/(double)nLoopsPerSecond; long startTime = System.currentTimeMillis(); long currentTime; int i = 0; while ((currentTime = System.currentTimeMillis()) < startTime + seconds*1000) { System.out.println(i++);...

How to Increment variable in java every 24 hours , every week, every month? [closed]


java,date,time,increment
I have 3 variables whose values I want to increment by 1 every 24 hours , every week and every month. The JAVA program will be running continuously during the time period.

Regex pattern for date and hour


regex,date,time
I want to use regex to validate text fields in JSF. Could someone tell me the pattern for hours (hh: mm) and date (dd / mm / yyyy). I tried the following patterns, but without knowing anything. <f:validateRegex pattern="[0-9][0-9]:[0-9][0-9]" /> <f:validateRegex pattern="[0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]" /> ...

Why Google Analytics show bounce rate 100% and avg time more then 1min


time,google-analytics,bounce,rate
How is possible to have on a page a bounce rate = 100% and for the same page an average time on page > 1min ? screenshot here...

Convert long int seconds to double precision floating-point value


c++,date,datetime,time,converter
I have a long int variable wich containes seconds since Jan. 1, 1970 in this format: long int seconds = 1231241242144214; i need to convert this seconds to double precision floating-point value. The integer part of the value is the number of days since midnight, 30 December 1899. The fractional...

Javascript how to start script on exact time


javascript,loops,time,setinterval
script will start on exact time (ex: 2015:06:15:00:00) If its on time, it will alert HELLO every 1 second. setInterval(function () {alert("Hello")}, 1000); could you please help me how to make this on up?...

12 Hour Clock Array Sort


php,arrays,sorting,time,clock
I have been searching on Google and couldn't find any solution to sort an array according to the 12 Hour clock format. I was able to sort the 24 hour clock by converting it to timestamps and then using krsort. But I am not sure how to sort a 12...

Convert time based on timezone using java.time


java,time,java-8,java-time
How to change the time based on timezone in LocalDateTime, here i have built a date with Time zone as EST, now i need to find the UTC of the corresponding time. please help me how to solve this String str = "16Jun2015_153556"; DateTimeFormatter formatter = DateTimeFormatter.ofPattern("ddMMMyyyy_HHmmss"); formatter.withZone(ZoneId.of("EST5EDT")); LocalDateTime dateTime...

How do you start a function at a certain time in Python?


python,multithreading,events,time,condition
I have a list of timestamps, and I need to call a specific method when those timestamps are reached. Those timestamps are roughly 20ms apart. At the moment I am using busy waiting in a separate thread, but I am worried about the CPU overload. Example : while True: if...

need the way to put Date in Parse.com without Time and the opposite


android,date,time,parse.com
Can't figured how to put just Date or just Time to Parse.com. Even after SimpleDateFormat the Date objects transferring with full default missing data. Code samples: DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); DateFormat timeFormat = new SimpleDateFormat("HH:mm"); try { date = dateFormat.parse(mDate.getText().toString()); time = timeFormat.parse(mTime.getText().toString()); } catch (java.text.ParseException e) { ......

How to convert date into timeago


javascript,html5,time,timeago
I am trying to convert a date field in a "timeago" format using jquery.timeago.js $("time.timeago").timeago(); var userSpan = document.createElement("span"); userSpan.setAttribute("class", "text-muted"); userSpan.appendChild(document.createTextNode(message.usernameSender +" | ")); var timeTag = document.createElement("time"); timeTag.setAttribute("class", "timeago"); timeTag.setAttribute("datetime",document.createTextNode(message.date)); userSpan.appendChild(timeTag); This javascript will genearate the following code <span...

Operators suddenly not working


time,vbscript,operators
A week ago I wrote this script which starts up when you log in and then greets you according to the time of the day. This morning it suddenly suddenly said: "Invalid time" (it would do that if all other elseif options wouldn't match the time). This used to work...

having issues with python time object


python,date,time
i am having a small program that gets time from system and dose some arithemetic on it. here is my code: import time import datetime c_time = time.strftime("%H:%M;%S") # now to convert it into time object i am using c_time_converted = datetime.datetime.strptime(c_time,"%H:%M;%S") print c_time_converted the output is of the form...

Format Date VARIABLE to short date VBA


vba,date,time
I have a user inputted via a userform.textbox.value. General date that I want to switch to a short date. (Or try to get the time to drop so it reads 00:00). I tried the code sDate=format(date,(d)) but that returns the current date rather than the variable date without the time....

Python - creating a delay that takes in account the execution time


python,image-processing,time,delay
i am writing a function that reads N (800*600) frames from a bin file in one sec. the FPS is user controllable import time def getFrame(file,N): #read N frames per second, 800X600 pixels each from file start = time.time() delay = (1/float(N)) while N: frame = file.read(480000) time.sleep(delay) N -=...

Changing div style for every day of the week script


javascript,css,time
This is my project: http://jsfiddle.net/yL0o1cy0/ .calendar { width: 850px; height: 500px; background-color: #141414; border-radius: 10px; padding-top: 10px; margin-top: 15px; margin-left: 15px; } #calendartest1 { width: 778px; height: 200px; position: relative; margin-left: auto; margin-right: auto; } #calendartest2 { width: 778px; height: 200px; position: relative; margin-left: auto; margin-right: auto; margin-top: 50px; }...

Android - Re-use TextView showing current date time in multiple activities


android,time,textview
I have some activities displaying the current date and time. I want to make only one text view (layout) txtTime showing time and it will be updated each second by a handler in main activity. Then others views of other activities can re-use the text view txtTime by including. (I...

Teradata Convert DATE to midnight


date,time,teradata
below is the original code convert(datetime, (substring(convert(varchar(26), convert(datetime,getdate())),1,12) + '23:59:59:996')) output is = 6/17/2015 11:59:59.996 I converted it to Teradata below CAST(CURRENT_TIMESTAMP AS DATE FORMAT 'MM/DD/YYYY') || ' 23:59:59:999990' but upon compiling my store proc, it produces an error below Invalid or missing expression 'E(5404):Datetime field overflow.'. Is there a...

Echo of time not displayed at end of batch file


batch-file,time,echo
Here is my batch file: @echo off set start=%time% echo %start% for /d %%i in (*) do ( mkdir "%1\%%i" cd %%i for %%j in (*.mp4) do ( echo "%1\%%i\%%j "..\ffmpeg32" -loglevel panic -i "%%j" -c:v libx264 -preset fast-crf 50 -c:a copy -y "%1\%%i\%%j" ) cd .. ) set end=%time%...

Set LocalDateTime to autogenerate with hibernate 4.3.10


java,hibernate,time
Currently I have a base entity as follows: @MappedSuperclass public abstract class BaseEntity { @Id @GeneratedValue(strategy=GenerationType.SEQUENCE) private Long id; private boolean deleted; @Convert(converter = LocalDateTimePersistenceConverter.class) private LocalDateTime createdAt; @Convert(converter = LocalDateTimePersistenceConverter.class) private LocalDateTime updatedAt; } Is it possible to annotate LocalDateTime with something to make database default to current date...

Time format conversion with PHP


php,time
If have the duration for a recipe in the format 1H10M (1 hour, 10 minutes) or 20M (20 minutes). I want to use the format as described in the parentheses. I've tried using strtotime() without luck. Any help would be greatly appreciated....

Disk read/write perfomance in linux


linux,time,dd
I wanted to check the read/write performance of my disk. I am executing the below command to write into a file time dd if=/dev/zero of=/home/test.txt bs=2k count=32k; which gives about 400MB/s For checking the read performance i have executed below commands.with and without 'of' parameter. There is a huge difference...

ORACLE SQL: Select records with time difference less than a minute


sql,oracle,time,difference
I have a table in which I have same the records but with different timestamps. E.g. - 1 2015-03-03 13:41:11.0 [createService]: [accountNumber = 123456] 2015-03-02 01:19:11.0 [createService]: [accountNumber = 123456] 2015-03-02 01:19:06.0 [createService]: [accountNumber = 123456] E.g. - 2 2015-03-07 01:21:11.0 [createService]: [accountNumber = 567890] 2015-03-04 01:17:11.0 [createService]: [accountNumber =...

Perform a task each interval


java,time,schedule
So I'm trying to schedule a time instance where it repeats every 10 seconds. Right now I have something that does a task after 10 seconds, but how do I make it so that it resets after doing so. this.schedule = TimerManager.getInstance().schedule(new Runnable() { @Override public void run() { chrs.get(0).getMap().spawnMonsterOnGroudBelow(MapleLifeFactory.getMonster(100100),...

Javascript time differs from Java time


java,javascript,servlets,time
i'm running a JavaServlet and as JavascriptApp on the same machine. The servlet outputs the current time: @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ServletOutputStream os = resp.getOutputStream(); os.print("" + System.currentTimeMillis()); } The JS Gets the time: $.get("UserdataServlet", function(data) { console.log("dy " + data); console.log("my "...

Can someone explain this odd javascript date output?


javascript,date,datetime,time
https://jsfiddle.net/8cvhnwgs/1/ //new Date(year, month, day, hours, minutes, seconds, milliseconds) $("#out").html(new Date(2015, 5, 31, 08, 25, 30, 0)); The date I give is May 31st, but it outputs July First, can someone explain why? Have I used arguments wrong?...

Swift - Convert Milliseconds into Minutes, Seconds and Milliseconds


swift,time,nsdate
I am writing a racing app and want to convert a large number of milliseconds into minutes:seconds.milliseconds (for example, 1:32.361). At the moment I just do it through maths (minutes / 60000), then get remainder and divide further, etc., but i find that it is off every now and then...

php why do i allways get a 1 on date [duplicate]


php,date,time
This question already has an answer here: A non well formed numeric value encountered 5 answers so this is weird i dont understand why i am getting this but anyway my code is $checkTime = "00:00"; echo 'Check Time : '.date('H:i', $checkTime); echo "<br>"; the value allways gets output...

Difference in time is giving Invalid date


javascript,asp.net,time
I have a scenario, where I want to show the total time of employee after calculating the InTime and OutTime from the first two textboxes. Here Is the scenario, In first textbox User will add INTIME In Second textbox User will add OUTTIME. As soon as both the values are...

convert time to to 12 hour by manipulate string


javascript,jquery,datetime,time
"2015-06-23 14:00:00" I tried to format above date time into 12 hour base but stuck in somewhere. function formatDate(raw_date){ var right = raw_date.substring(10, 0); var hours = ((right[0].substring(2,0) + 11) % 12 + 1); var min = raw_date.substring(14,16); var suffix = right[1] >= 12 ? "PM":"AM"; right[1] = ((right[1] +...

Is timezone info redundant provided that UTC timestamp is available?


datetime,time,timezone,timestamp,timestamp-with-timezone
I have a simple mobile app that schedules future events between people at a specified location. These events may be physical or virtual, so the time specified for the event may or may not be in the same timezone as the 'location' of the event. For example, a physical meeting...

Using Master theorem to calculate asymptotic time complexity of algorithm


algorithm,time,complexity-theory,master,theorem
Problem: You have an algorithm that divides n size problem to six subproblems with size of one quarter of the original. For dividing the algorithm makes 100 steps and for merging 75n. What's the time asymptotic complexity of an algorithm? So the formula for Master Theorem and for this problem...

Batch - xcopy files older than x minutes


batch-file,time,copy
after a new file creation time of 20 min I want to copy all files with the extensions .txt from Folder New to Folder Target. (I want to copy olny files are older than 20 min) So far, it looks like this: set hh=%TIME:~0,2% set mm=%TIME:~3,2% set ss=%TIME:~6,2% set /a...

The simple timezone clock function falls into incorrect condition and I have no idea why


javascript,function,time
I implemented a simple timezone clock and it somehow does not change time based on different timezone, after a few debugging I found out it falls to incorrect "if" condition. Here's the code: var zone = "ho"; alert("1"+zone); var ft; var dt = new Date(); var def = dt.getTimezoneOffset()/60; var...

performance.now() vs Date.now()


javascript,time
What is the difference between performance.now() and Date.now()? Should I consider performance.now() as a replacement for Date.now() since performace.now() is more consistent and independent?...