I want to check if a date is greater than a specified date using VBScript in Classic ASP.
The same thing i got working in the following :
Check if a date is greater than specified date
but the above is using javascript.
I did it using JavaScript as :
var Jun16 = new Date('JUN-2016')
var SelectedDate=new Date("<% =session("month")%>" + "-" + "<% =session("yrs")%>")
if(SelectedDate.getTime() > Jun16.getTime())
{
grossinc=parseInt("<% =rset1("othermontize_benefit") %>") + parseInt("<% =rset1("basic") %>") + parseInt("<% =rset1("house") %>") + parseInt("<% =rset1("utility") %>")
}
else
{
grossinc=parseInt("<% =rset1("gross") %>") + parseInt("<% =rset1("bonus") %>") + parseInt("<% =rset1("arrears") %>") + parseInt("<% =rset1("ot") %>")
}
How can I get the same in vb in classic asp.
EDIT :
the data which is to be compared is in MON AND YYYY format , there is no such any date , month is selected from months dropdown in MON Format and year is selected from years dropdown in yyyy format , now i want to check if the selected criteria is greater than JUN-2016 ?
Thanks.
Something like this should work for you:
jun16 = CDate("Jun-2016") ' jun16 = 01/06/2016 00:00:00
selectedDate = CDate(Session("month") & "-" & Session("year"))
If selectedDate > jun16 Then
Response.Write("Geater")
Else
Response.Write("Less than or equal to")
End If
Related
i have a case where i enter a searchTerm to a search field. Then I want to count the results shown to randomly select one of the entries. But I cannot realize it with cypress
let countOfElements = "";
cy.get(this.SEARCH_RESULT + ' > a').then($elements => {
countOfElements = $elements.length;
cy.log(countOfElements)
cy.log("Found " + countOfElements + " results for search term + " + searchTerm)
});
cy.get(this.SEARCH_RESULT + ' > a').invoke('val').as('searchEntries')
//This is obviosly not working, but I don't get how to fix this.
let randomNumber = this.getRandomNumberBetweenTwoValues(0, cy.get('#searchEntries')));
cy.get(this.SEARCH_RESULT + ' > a').eq(randomNumber).click()
I tried different things, like storing the value with .as() but I never seem to have access to the value outside a .then() block. So how I can use the value in my "getRandomNumber..." function to decide with entry in the result list shall be selected?
Pls help. thx
let countOfElements = "";
cy.get(this.SEARCH_RESULT + ' > a').then($elements => {
countOfElements = $elements.length;
cy.log(countOfElements)
cy.log("Found " + countOfElements + " results for search term + " + searchTerm)
});
cy.get(this.SEARCH_RESULT + ' > a').invoke('val').as('searchEntries')
//This is obviosly not working, but I don't get how to fix this.
let randomNumber = getRandomNumberBetweenTwoValues(0, this.searchEntries);
cy.get(this.SEARCH_RESULT + ' > a').eq(randomNumber).click()
Something like this could work. If this.searchEntries give undefined error then make the block function(){} instead of ()=>{}
I am trying to create a simple script that prompts the user for their birthday, formatted as 10.02.20, then takes that string and turns it into text, such as October 2nd 2020. I have the following code:
Dim bd, message, title ' define variables
title = "What is your birthday?" ' set variable
message = "Format like so: 12.15.07; 3.03.05" ' set variable
bd = InputBox(message, title) ' prompt user
Dim year
year = bd.Substring(6, 2)
Dim month
month = bd.Substring(0, 2)
Dim day
day = bd.Substring(3, 2)
msgbox bd ' for testing
call msgbox(year + month + day) 'also testing
And I am getting an error after the prompt, ...\Desktop\test.vbs(8, 1) Microsoft VBScript runtime error: Object required: '12.23.03' and I am not sure what it means, Object Required.
Any fixes or suggestions would be very much appreciated.
You cannot use Substring in VBScript. You can use Mid instead:
Dim year
year = Mid(bd, 7, 2)
The first character in a string is at position 1, not 0, so I adjusted your parameter from 6 to 7.
Also, to concatenate strings, although + works, you can also use &:
call msgbox(year & month & day)
You can use this function in vbscript : FormatDateTime(date,format)
Parameter Description
date Required.
Any valid date expression (like Date() or Now())
format Optional.
A value that specifies the date/time format to use can take the following values:
0 = vbGeneralDate - Default. Returns date: mm/dd/yyyy and time if specified: hh:mm:ss PM/AM.
1 = vbLongDate - Returns date: weekday, monthname, year
2 = vbShortDate - Returns date: mm/dd/yyyy
3 = vbLongTime - Returns time: hh:mm:ss PM/AM
4 = vbShortTime - Return time: hh:mm
Dim Title,Input
Title = "format date"
Input = InputBox("Enter your date of Birthday !",Title,"10.02.20")
Input = FormatDateTime(Replace(Input,".","/"),1)
MsgBox Input
Trying to use Vue for the first time.
I dont know how to change the datetime in Vue.
I know it works in laravel, like this:
{{ date("d.m.Y", strtotime($file->created_at)) }}
How can I change datetime in Vue?
This is what I tried in Vue:
<time datetime="1.1.2019">#{{ file.created_at }}</time>
and it shows me the exact database entry on the view page:
2019-01-25 12:03:40
But I want it to appear like this:
25.02.2019 12:03. 40
Thank you!
Create a Vue method -
formattedDate:function(d){
let arr = d.split(/[- :]/);
let date = new Date(Date.UTC(arr[0], arr[1]-1, arr[2], arr[3], arr[4], arr[5]));
return date.getDate() + "." + (date.getMonth() + 1) + "." + date.getFullYear() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds()
}
And then Call that method within double curly brackets
<time datetime="1.1.2019">#{{ formattedDate(file.created_at) }}</time>
I am using Xamarin Prism along with Sqlite-pcl-net Nuget .
While I write Query to obtain the elements of table between a range of dates as follows
public Task<List<JournalModel>> GetRecieptListAsync(DateTime startdate,DateTime enddate)
{
return database.QueryAsync<JournalModel>("SELECT * FROM [JournalModel] WHERE ( [PromisedDate] BETWEEN " + startdate + " AND " + enddate + ")");
}
StartD and EndD are variables of DateTime Datatype of Format:
StartD MM/dd/yyyy 00:00:00
EndD MM/dd/yyyy 23:59:59
After executing this Query I get a
SQLite.SQLiteException: near "12": syntax error
Which means at the hour of StartD. I hope You know it takes 12:00:00Am at StartD in the Database. Comment if I have to make more clearifications.
In SQLite-pcl-net the default format for Datetime is Ticks.
You can change startdate to startdate.Ticks and enddate to enddate.Ticks.
return database.QueryAsync<JournalModel>("SELECT * FROM [JournalModel] WHERE ( [PromisedDate] BETWEEN " + startdate.Ticks + " AND " + enddate.Ticks + ")");
var query = from s in bv.baParticularHeaders
from v in bv.baPlanColumnStructures
where x.Contains(s.Particular_Num)
select new LevelList
{
Value = 'Level ' + LTRIM(Rtrim(Convert(Char,P.Level_Num))) + ' - ',
id = 'Column ' + LTRIM(Rtrim(Convert(Char,P.Column_Num))) + ' ',
Text = v.Column_Description
};
return query.Distinct().OrderBy(o => o.Value).AsQueryable<LevelList>();
Error getting this both lines of code.
Value = 'Level ' + LTRIM(Rtrim(Convert(Char,P.Level_Num))) + ' - ',
id = 'Column ' + LTRIM(Rtrim(Convert(Char,P.Column_Num))) + ' ',
Can any body help me out how to convert this in LINQ?
Thanks
You can't just cut and paste SQL, rearrange it and hope to get a valid LINQ query. The aim is to write the appropriate C# code, which is translated into SQL. In this case I suspect you want:
var query = from s in bv.baParticularHeaders
from v in bv.baPlanColumnStructures
where x.Contains(s.Particular_Num)
select new LevelList
{
Value = "Level " + P.Level_Num + " - ";
id = "Column " + p.Column_Num + " ",
Text = v.Column_Description
};
return query.Distinct().OrderBy(o => o.Value).AsQueryable();
Note the string literals - "Level " not 'Level '. The code has to be valid C# first.
(Assuming Level_Num and Column_Num are numbers, I can't see why it would make sense to trim them.)