Changing the default date format in classic asp when using the "date" function - date

I'm migrating a whole bunch of web pages that were written in classic asp over to a new server, and have discovered many references to the simple date() function, like:
if cint(left(date,instr(date,"/")-1)) < 9 then blah blah
I'm getting errors because the new server's default date format is returning yyyy-mm-dd, and the code above is expecting it to be in dd/mm/yyyy format.
Rather than manually fixing every occurrence, of which there could be hundreds, I'm looking to see if I can change the default date format for asp so that date() returns dd/mm/yyyy. I thought by simply changing the system's short date format would do the trick, but even after restarting the server it's still showing yyyy-mm-dd.
Is there a setting somewhere where you can specify the default date format when using the date() function?

This worked for me:
change global.asa, in the Sub Session_OnStart, add a line
Session.LCID=1033

Related

Rundeck time format

In the "Activity for jobs' page in Rundeck the execution time has a relative time field (example: "Today at 10:15 AM" or "Last Sunday at 4:51 AM") after the timestamp.
It is easy to change the date format of the timestamp by adding jobslist...format[.ko] in the i18n/messages.properties file.
It seems impossible however to change the format of the relative time message. It seems to be hard-coded in en_US with AM/PM which doesn't look too good in in non-English-speaking countries. The format is always the same regardless of the ?lang=xx parameter or the default language in the browser. Interestingly, other objects (like hovering over the field with the mouse and the duration get translated).
Has anyone successfully changed this?
Example. See the duration field
I have been trying this with the docker images (4.8.0, 4.9.0 and SNAPSHOT)
I've looked at the source code and apparently this lies somewhere in the moment.js code.
In some parts, the date formats are hard coded as you say, please add your use case on this thread.

Export Calendar Date to spreadsheetout - Time Stripped off - Google Script

I am using Google Script to export some calendar events to a spreadsheet; the relevant portion of my script is below:
var details=[[mycal,events[i].getTitle(), events[i].getDescription(), events[i].getLocation(), events[i].getStartTime(), myformula_placeholder, ('')]];
var range=sheet.getRange(row,1,1,7);
range.setValues(details);
This code works but the "time" that is put into the spreadsheet is a real number of the form nnnnn.nn. On the spreadsheet itself the date looks great using the integer to the left of the decimal (eg 10/15/2017) but the decimals are part of the value and therefore are part of the spreadsheet value.
My script drops the data into a sheet in my workbook, and another sheet reads the rows of data with the above date types, looking for specific date info from the other sheet using the match function (for today()). That would work fine if I could get rid of the decimals.
How can I use what I have above (if I stray far from what I have found works I will be redoing hours of work) but adding just what is needed to only put into the output spreadsheet the whole number portion so I have a pure date that will be found nicely by my match function using today()?
I have been digging, but errors abound in trying to put it all together. "Parse" looked like a good hope, but it failed as the validation did not like parse used within getStartTime. Maybe I used it in the wrong manner.
Help would be appreciated greatly.
According to the CalendarApp documentation, getStartTime() generates a Date object. You should be able to extract the date and time separately from the date object:
var eventStart = events[i].getStartTime(); // Returns date object
var startDate = eventStart.toDateString(); // Returns date portion as a string
var startTime = eventStart.toTimeString(); // Returns time portion as a string
You could then write one or both of these to your spreadsheet. See the w3schools Javascript Date Reference for more information:
http://www.w3schools.com/jsref/jsref_obj_date.asp
If you If you want to specify the string format, you can try formatDate in the Utilities service:
https://developers.google.com/apps-script/reference/utilities/utilities#formatdatedate-timezone-format
You could just use the Math.floor() function
http://www.w3schools.com/jsref/jsref_floor.asp
which will round the real number to an integer. Your line would then read:
var details=[[mycal,events[i].getTitle(), events[i].getDescription(), events[i].getLocation(), Math.floor(events[i].getStartTime()), myformula_placeholder, ('')]];

SSRS 2012 date culture settings

My issues is somewhat related to this article. ssrs-date-culture-error
I get the date type mismatch when generating a report using the SSRS 2012 web service in my website.
However this does not make sense as an older setup using SSRS 2005 works with all settings in line and the same.
Since we upgraded to SSRS 2012 this issue has popped up.
To explain the issue:
I have a website using shortdate format: en-ZA "dd/mm/YYYY"
The account that SSRS 2012 executes under: en-US "dd/mm/YYYY" (note it is different from the default en-US settings)
The website uses the web service "ReportExecution2005.asmx" and passes a dictionary of string to generate. In this dictionary the date is converted to string without a format.
I would assume that give the above setup, all culture settings are in line that this work but doesn't.
I tried converting the date to string using military format yyyy-mm-dd as stated in the other article and it works.
However it does not make sense why the internally hosted webservice within SSRS 2012 does not understand the format being passed to it.
Why doesn't it assume the region/culture setting as per settings in the registry for the account it is running under?
Could it be that it is looking at en-US and it ignoring the dd/mm/YYYY and using a default setting?
Another article mentioned using en-GB as it's default setting for short date is dd/mm/YYYY.
I tried changing the account to execute under en-GB but that does not work either. It's seem like it would only work with "yyyy-mm-dd"
Any help would be appreciated.
Thanks

Sending parameters to report from Java code

I need to send a timestamp value as parameter from java to JR report. I tried the following code but I'm getting a blank report.
My JRXML File:
`
`
The report works fine with normal date parameter but fails to display with Time-stamp value.
My Java code :
`
I tried various values of timestamp Ex: (new java.sql.Timestamp(2013-02-27) but it is not working.
Use:
new SimpleDateFormat("yyyy-MM-dd").parse("2012-01-01");
Simply putting:
new Date(2012-01-01);
would give definitely wrong date, probably EPOCH start date.
Ensure it's MM not mm when parsing your date for month. See SimpleDateFormat javadoc
EDIT
See the image. The date your default values will generate is around 1970.
Hence your Between Condition will get all the values between 1970 to Today.
EDIT : 2
In my opinion You are setting wrong parameter in Table's datasource.
Instead of setting From_Date & To_Date from Fields set them as parameter from the main report itself.
Refer Image.

DateAdd() returns faulty Date in SQL Server Reporting Services

I have a report that takes a date as a parameter.
If I use =Parameters!Date.Value, the report runs fine.
However, if I use =DateAdd("d", 1, Parameters!Date.Value), the report is left blank, even though the formats are exactly the same:. (Note: it simply cannot run. It's not that there are no values to return as the field names don't return either.)
I have also tried =DateAdd(DateInterval.Date, 1, Parameters!Date.Value)
=DateAdd("d", 1, Parameters!Date.Value)
=DateValue(FormatDateTime(DateAdd("d", 1, Parameters!Date.Value), DateFormat.ShortDate )) and many variations thereof but I can't seem to crack it!
Update
If I use DateInterval.Month instead of DateInterval.Day then the date is still incremented as desired (12/22/2010) but the table shows up! Interesting how my local settings are dd-mm-yyyy and these dates are mm-dd-yyyy.
Try changing the locale of the report to EN-GB (I'm assuming you're in the UK), as the report might be getting confused between different date formats.