CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 CCS3 Date Time Picker (with Time)

Print topic Send  topic

Author Message
marcwolf


Posts: 361
Posted: 02/08/2006, 4:11 PM

Hi Folks.

I have seen a few posts re the DatePicker from Codecharge. Its a really nice design but it does lack.. Time capabilities.

I have a client who needs time entry and I have been pressed to try and provide a nice solution. Sure I can grab a non CCS one but it looks different from CCS's.

Anyay - I decided to look at the CCS one and see what I could do to make it work, and still work within the CCS environment.

When we declare a DatePickerObject CCS puts the following code into the HTML

var job_DatePicker_job_received_date = new Object();   
job_DatePicker_job_received_date.format           = "dd/mm/yyyy";  
job_DatePicker_job_received_date.style            = "Styles/Tranzblast/Style.css";  
job_DatePicker_job_received_date.relativePathPart = "";  
job_DatePicker_job_received_date.themeVersion = "3.0";  

So I had to work out a way add new parameters for the functionality

So that I did not cause CCS's generated HTML to have issues I moved to a boick of JS further down the page where CCS did not have it's checksums, and added my own calling parameters.
I'm explaining this so that people can modify my work further :-D

I then added these lines (the lines are optional depending on what you require)

job_DatePicker_job_received_date.showtimes =12  
job_DatePicker_job_received_date.showseconds =1  
job_DatePicker_job_received_date.resetbutton=1  
job_DatePicker_job_received_date.format  = "dd/mm/yyyy hh:nn AM/PM"  
  
.

Ok - what do these do...

ShowTimes can be 0 (for no time entry), 12 for 12 hour, and 24 for 24 hour

ShowSeconds can be 0 for no Second input, or 1 for Seconds entry

Resetbutton can be 0 for no button, or 1 to display a button that when pressed will CLEAR the date field. Sorry - i could not find a Clear button icon but I could find Reset.

Format is the date formmating string. This is what will overide the CCS;s one and allow you to format the fate as you want.

i.e.
dd/mm/yyyy HH:nn:ss is the full 24 hour time with seconds
dd/mm/yyyy hh:nn AM/PM is the 12 hour with AM/PM display

You get the general idea.

Now - to enable the text field to handle this you will need to increase it's length in the FORMAT tab, and to enable CCS to process it correctly it is best to change the format in the DATA tab to 'GeneralDate'

And that is all there is to it.

I have included a link to the JS file and some instructions.

Please let me know how you go. And remeber - CCS will overwrite this code so keep it in a safe place.

http://public.change-flow-pro.com/datetimeobject.zip

Take Care and Enjoy

Dave
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
View profile  Send private message
Walter Kempees
Posted: 02/09/2006, 12:27 AM

thanks
Benjamin Krajmalnik
Posted: 02/09/2006, 10:38 AM

One of my applications needs to be truely internationalized.
All of my dates are set to shortdate - that way an explicit date format is
not generated by codecharge.

I then modified CCFormatDate and DatePicker.js by adding a global setting.
For CCFormatDate, I am reading a global variable in a config file which
indicates whether the application is running mdy or dmy. With DatePicker.js
it was a little bit different. I modified it by adding a "DateFormat" flag
at the beginning. Set to 0 it uses US fomratting. Set to 1 it uses
internatinoal fomratting.


// Date formatting functions
begin ---------------------------------------------------

var GlobalDateFormat = 1; // Set format for client side date handling
0=mm/dd/yyyy, 1=dd/mm/yyyyy

I then modified formatDate and parseDate to behave differenty depending on
the switch, along the lines of:

case "ShortDate":
if (GlobalDateFormat == 0) { // use US setting
resultArray = formatDate(dateToFormat,
parseDateFormat("mm/dd/yyyy"));
} else { // use international setting
resultArray = formatDate(dateToFormat,
parseDateFormat("dd/mm/yyyy"));
}


Now, one of the most important items. The date format on the database needs
to be set to "yyyymmdd HH:nn:ss".
This works on all of the SQL servers I have tried so far, and bypasses the
"localization" by the SQL server (as was the case with SQL Server 2000).

Claudio Morinico
Posted: 02/09/2006, 10:42 AM

Thanks for sharing. I will try it when i get some free time.

--
Claudio Morinico,
Montevideo - Uruguay.
dennisb

Posts: 6
Posted: 05/26/2006, 11:45 AM

I think this is great and very useful. I have noticed one thing, but it may be in my trying to implement this. If I clickthe Today button, the time gets inserted along with the data correctly, AM or PM. However, if I click a date on the calandar in the PM, the entry reverts to AM and has to be changed. If I use the date/time picker in the morning, cilcking on the date or on Today both work as expected.

Maybe I have missed something.

But this is a great feature for adding the time to the date picker.

Dennis

Quote marcwolf:
Hi Folks.

I have seen a few posts re the DatePicker from Codecharge. Its a really nice design but it does lack.. Time capabilities.

I have a client who needs time entry and I have been pressed to try and provide a nice solution. Sure I can grab a non CCS one but it looks different from CCS's.

Anyay - I decided to look at the CCS one and see what I could do to make it work, and still work within the CCS environment.

When we declare a DatePickerObject CCS puts the following code into the HTML

var job_DatePicker_job_received_date = new Object();   
job_DatePicker_job_received_date.format           = "dd/mm/yyyy";  
job_DatePicker_job_received_date.style            = "Styles/Tranzblast/Style.css";  
job_DatePicker_job_received_date.relativePathPart = "";  
job_DatePicker_job_received_date.themeVersion = "3.0";  

So I had to work out a way add new parameters for the functionality

So that I did not cause CCS's generated HTML to have issues I moved to a boick of JS further down the page where CCS did not have it's checksums, and added my own calling parameters.
I'm explaining this so that people can modify my work further :-D

I then added these lines (the lines are optional depending on what you require)

job_DatePicker_job_received_date.showtimes =12  
job_DatePicker_job_received_date.showseconds =1  
job_DatePicker_job_received_date.resetbutton=1  
job_DatePicker_job_received_date.format  = "dd/mm/yyyy hh:nn AM/PM"  
  
.

Ok - what do these do...

ShowTimes can be 0 (for no time entry), 12 for 12 hour, and 24 for 24 hour

ShowSeconds can be 0 for no Second input, or 1 for Seconds entry

Resetbutton can be 0 for no button, or 1 to display a button that when pressed will CLEAR the date field. Sorry - i could not find a Clear button icon but I could find Reset.

Format is the date formmating string. This is what will overide the CCS;s one and allow you to format the fate as you want.

i.e.
dd/mm/yyyy HH:nn:ss is the full 24 hour time with seconds
dd/mm/yyyy hh:nn AM/PM is the 12 hour with AM/PM display

You get the general idea.

Now - to enable the text field to handle this you will need to increase it's length in the FORMAT tab, and to enable CCS to process it correctly it is best to change the format in the DATA tab to 'GeneralDate'

And that is all there is to it.

I have included a link to the JS file and some instructions.

Please let me know how you go. And remeber - CCS will overwrite this code so keep it in a safe place.

http://public.change-flow-pro.com/datetimeobject.zip

Take Care and Enjoy

Dave
View profile  Send private message
favc4

Posts: 30
Posted: 06/26/2006, 10:49 AM

Hi folks; I just can't make this work, first, I suppose
job_DatePicker_job_received_date.showtimes =1
mycontroldatepicker.showtimes=1;
Am I correct? please advise
_________________
Programming win32 and went crazy...
View profile  Send private message
favc4

Posts: 30
Posted: 06/26/2006, 11:14 AM

Wish! I find somewhat missleading not to have an 'OK' button because the time picker textboxes are below the calendar, and final user is oriented to pick first the date (wich causes the calendar to close) so it would be nice to have that disabled and an ok option within the component... I have ZERO java skills and therefore I am not able to do it by myself; however I am very very thankfull to all of you that kindly share your knownledge to help out all of us that are less skilled than you!

Thanks again
_________________
Programming win32 and went crazy...
View profile  Send private message
favc4

Posts: 30
Posted: 06/26/2006, 11:14 AM

Wish! I find somewhat missleading not to have an 'OK' button because the time picker textboxes are below the calendar, and final user is oriented to pick first the date (wich causes the calendar to close) so it would be nice to have that disabled and an ok option within the component... I have ZERO java skills and therefore I am not able to do it by myself; however I am very very thankfull to all of you that kindly share your knownledge to help out all of us that are less skilled than you!

Thanks again
_________________
Programming win32 and went crazy...
View profile  Send private message
marcwolf


Posts: 361
Posted: 06/29/2006, 7:32 PM

Hi Favc4

All I did was modify the existing Datetime picker. I do understand your wishes but to implement that would mean a total re-write of the datepicker.

I know there are other other there that you could modify in time..

Take Care

Dave
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
View profile  Send private message
Aaron


Posts: 145
Posted: 08/22/2006, 10:00 AM

Dave,

I like what you've done here. I'm currently playing with your example code above, but the link to your zip file doesn't exist. Is there anyway you can repost a link or perhaps PM me a link? I'd greatly appreciate it.

Thanks,

Aaron

PS- CCS programming team, if you're reading this, this feature would be very nice to have included in the next release. ;-)
View profile  Send private message
marcwolf


Posts: 361
Posted: 08/23/2006, 9:58 PM

Hi Aaron

Sorry - My boss used the subdomain for another purpose

Try this link

http://djb.change-flow-pro.com/datetimeobject.zip

Take care

Dave

_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
View profile  Send private message
Aaron


Posts: 145
Posted: 08/24/2006, 12:17 PM

Yep. That worked fine.

Thank you

Aaron
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.