Gossamer Forum
Home : Products : DBMan : Customization :

Date field

Quote Reply
Date field
I need to pickup the system date in the form. How do I do this ?



Quote Reply
Re: Date field In reply to
You should set your date field in the default.cfg file to the following:

Code:
Date => [1, 'date', 12, 15, 1, &get_date, ''],
Now...if you want to print this value in the add, modify, and delete forms, simply add the following hidden field in the sub html_record_form routine, so that users cannot modify it, but admin can:

Code:
if ($per_admin) {
print qq|<input type="text" name="Date" value="$rec{'Date'}">|;
}
else {
print qq|<input type="hidden" name="Date" value="$rec{'Date'}">$rec{'Date'}|;
}
Regards,

Eliot Lee
Anthro TECH, L.L.C
Web: http://www.anthrotech.com/
Quote Reply
Re: Date field In reply to
Thanks Eliot !

It works, Only problem is that It does not show my local date because of time zone problem.
I am located in india GMT+5.30 How do I get it right ?

Regards

Vijay
Quote Reply
Re: Date field In reply to
There is a Date.pm module at http://cpan.org that you can replace for the Local.pm module called in the sub date_to_unix routine in the db.cgi file.

Also, webmaster33 (a LINKS user), is working on a new International date module for LINKS that could be adapted to DBMAN.

Regards,

Eliot Lee
Anthro TECH, L.L.C
Web: http://www.anthrotech.com/
Quote Reply
Re: Date field In reply to
There are so many modules for date, Which one should I pickup ?

Regards

Vijay
Quote Reply
Re: Date field In reply to
The one that gives International Dates.

Regards,

Eliot Lee
Anthro TECH, L.L.C
Web: http://www.anthrotech.com/
Quote Reply
Re: Date field In reply to
I was just wondering if there is any way to "Adjust" the time through the script. I am not that familiar with installation of Perl modules and also I do not have complete control on my server.



Regards

Vijay
Quote Reply
Re: Date field In reply to
JPDeni wrote some data modifications awhile back and I believe they are posted in the Resource Center. If they do not help you, let us know and we can try to help you re-configure the time.

BTW: There is a time hack for LINKS in the FAQs in the Resource Center for LINKS that may help you.

Regards,

Eliot Lee
Anthro TECH, L.L.C
Web: http://www.anthrotech.com/
Quote Reply
Re: Date field In reply to
My date mod won't work for this.

Miheer, if your server returns GMT from the time() function, you would need to add 19800 to get GMT+5:30.

For example, to change the time returned from sub get_time, change

my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime(time());

to

my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime(time() + 19800);

JPD
Quote Reply
Re: Date field In reply to
J P Deni, Greetings !

I do not understand much about Perl but I generally give a TRY and GO with help from nice and helpful people like you and more often then not succed.

When I do Telnet and give "date" command the server returns me like this
Wed May 17 06:31:24 PDT 2000
Now, I am located in India and it is 7:00PM or 19:00:00 hrs. now.
My server is located in USA. Can you figure out anything ?




Regards

Vijay
Quote Reply
Re: Date field In reply to
The date things are always hard for me to figure out. Smile

I'm pretty sure that you can use

my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime(time() + 45000);

in sub get_time.

The 45000 is the number of seconds that your time differs from your server's time -- 12 and a half hours.

If this works for you, be aware that you will have to make a change to this at the end of October, when we in the US go back to regular time instead of "daylight savings time." I'm not even sure right now which way it would go. You'll have to either add or subtract 3600 from the 45000.


JPD
Quote Reply
Re: Date field In reply to
There You are !

I first tried only with sub get_time only it didn't work. When I inserted it in sub get_date it worked !

Thanks once again.

Regards

Vijay
Quote Reply
Re: Date field In reply to
I don't know what was wrong with me. You specifically mentioned the Date field, and I was talking about sub get_time. I'm glad you were able to figure it out. Smile

JPD