Date from SQL datebase to JCalander - string

I used http://toedter.com/ jDateChooser to get the date from user. But now I want to reset the selected date to the calendar from SQL database. This is the code I wrote to put selected date to database.
pst.setString(5, ((JTextField)datead.getDateEditor().getUiComponent()).getText());

I figured it out myself.
java.util.Date dateadx = new SimpleDateFormat("yyyy-MM-dd").parse(dateadm);
Here dateadm is the String variable which you want to store as date in JDateChooser.
Then you can simply call
datead.setDate(dateadx)
to set the date.

Related

Retrieving data from Postgres Sql and displaying in a datepicker

I am a newbie in fullstack development. I am doing my first project using postgresql, nodejs and express(ejs template). In my task list project i have a duedate option, where i enter a duedate(date picker) for a task and it get saved in the postgres database. I have an edit option aswell with a datepicker. how can i retreive the date in the 'dd/mm/yyyy' format from the database and display it inthe date picker in the edit page?.is it possible. Please help.
Thanks
What gets stored in the DB for date will probably look different then what you see on the front-end, simply because date / time is usually stored as UTC etc ( this will depend on how you have the table configured)
Next, you can use javascript built in date function like toLocaleDateString('en-US') to get a mm/dd/yyyy format from the stored date in the DB
What this means is that on the front-end you would pull the date from the DB as normal, then for the date-picker you would just pass the date over like
let myDate = new date([date from db); // this create a new date object off the date from the DB
//Now we make is a readable date
// myDate = myDate.toLocaleDateString('en-US'); // will give mm/dd/yyyy

Historian retrieve data

I have an Excel worksheet that I have the data pulled from a Historian database for emission tags in a Wonderware server. I need to know how i can write the SQL query that uploads data between two date ranges.starte date end date.
I have collected the data and display I want, I just dont know how I can implement between two date ranges the user types in on another form. I DONT KNOW HOW TO DO THIS.
I have tried nothing because im not sure how to implement a parameter query with excel.
SET QUOTED_IDENTIFIER OFF
SELECT * FROM OPENQUERY(INSQL, "SELECT DateTime, [AB01_PE01], [NU_DC01_DX01_DISPLAY],
[NU_DC01_DX02_DISPLAY], [NU_DC02_DX01_DISPLAY], [NU_DC02_DX02_DISPLAY],
[NU_DC03_DX01_DISPLAY], [NU_DC03_DX02_DISPLAY], [NU_DC05_DX01_DISPLAY]
FROM WideHistory
WHERE wwRetrievalMode = 'Cyclic'
AND wwCycleCount = 14
AND wwVersion = 'Latest'
AND DateTime >= '20190501 06:00:00.000'
AND DateTime <= GetDate()")
what I want is where Datetime >= is I need to set up where it ask the user the start date and end date? I do not know how to do this in excel I am new to the historian add in.
Based on your comment response, I understand your real question is: how to parameterize SQL query in Excel. This video shows step by step guide to do that: https://youtu.be/xPalEw4xw1w?t=129

Orchard CMS Query Creation Date

I'm new to Orchard CMS and trying to create a query that will filter a list of upcoming events date. What I want to do is filter a list of upcoming events. I have set up a list and plan to use the creation date (setting the date to the event date) as filter. Where I have ran into an issue is getting the filter value to work. When I set the filter value to {DateTimeField.Date} for get the current date or any of the other date options, the filter does not work. It show all events. When I manually type in the value field "2014-08-20", it works. Any ideas of why I can not set the date to the current date?
I have also tried creating just a date field within the content definition and received the same issue as above. I do plan to create a Event End Date that will not show, but will be used to filter. I assume the value will be very similar though to what would be needed for the creation date though.
I am using Orchard CMS 1.8.0
Any help will be greatly appreciated.
The current date can be obtained in Token form like this: {Date}. That token itself can be modified as a date token. In particular, it can be formatted. In your case, because the filter will construct a HQL filtering clause from your expression, {Date.Format:yyyy-MM-dd} will put the current date into the right format.

How to get the Current Date & Time Automatically to a Date Time Field

I have created a date time field I made today's date as the default value, Then I added it to a page layout and created a page, But the current Date Time is not picking up from the system.
I dont want to give the user to select a Date Time instead it should populated automatically
Is there anyway to achieve this without writing code in code behind files?
This is very similar to this question I think
SO - How to get Date and current time from the Date/Time column in SharePoint Custom list
My answer there gives a few options such as using the built in Created field, using a calendar template, a JavaScript hack and a custom field type.
Guys, fake [Today] trick worked for us - but prob is we only got the date value not datetime.
Janis, is it possible to get date and time both from the fake [today] column trick? pls refer few articles on the same
Does [Today] work?
If you have language pack applied to SharePoint, then you must use localized "Today" string.

Modx assign default date to template variable

I have a template variable of input type date but I'd like to have a default value of the current date at the time the document was first saved.
I've noticed that using the date formatter widget gives an option to "If no value, use current date" however it seems to use the date at the time it is being viewed rather than the date at the time the document was created.
Any help appreciated.
I think the only way to get the date when the article was saved for the first time is to use [ * createdon * ]
If there is a way to add the created date to a TV, I am not sure. I think your best shot would be to see if you have an event that you could "hook" you Template Variable, and then use the createdon variable everytime the article is saved! I am not sure this works, but This could be a possible!

Resources