MLUG: Re: [MLUG] Perl & mySQL question (Dying, help)
Re: [MLUG] Perl & mySQL question (Dying, help)
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
John Engelbrecht wrote:

Make that 'man Date::Format' once the perl TimeDate distribution from
CPAN is installed - I LOVE Date::Format for these types of things! And,
I can test on any system, which I can't do if i backtick \bin\date!

--Curtis

> Personally, I think doing 'man strptime' is a whole lot easier.
> I've been playing with it to come up with Status program for my PalmVx
> so when My Palm logs in, it shows time and date in how ever type of
> format I want
> 
> #include <time.h>
> 
> char td_time[30],td_ltime[30], td_date[30], td_ldate[30];
> 
> timedate()
> {
> struct tm *ptr;
> time_t ltime;
> 
>     ltime = time(NULL); /* get current calendar time */
>     ptr = localtime(&ltime);  // return time in the form of tm structure
>     strftime(td_date,30,"%I/%d/%Y (%A)",ptr);
>     strftime(td_ldate,30,"%h %d, %Y (%j)",ptr);
>     strftime(td_time,15,"%H:%M:%S",ptr);
>     strftime(td_ltime,15,"%m:%M:%S",ptr);
> }
> 
> On Thu, 6 Dec 2001, M. Kovalenko wrote:
> 
> > "Davis, Ryan Wiley (UMC-Student)" wrote:
> > >
> > [...]
> > > my $createtime = (now());
> > [...]
> > > it is in the 0000-00-00 00:00:00 format (datetimecreated DATETIME NOT NULL).
> >
> > I don't know of now() function in perl. I'd use localtime() (from man
> > perlfunc):
> >
> > $now_string = localtime;  # result: "Thu Oct 13 04:54:34 1994"
> >
> > But if you're using DATETIME type for datetimecreated field and not
> > TEXT, I bet it requires specific format, like '12/6/2001' or something.
> > INSERT won't work like that. You'll have to do some text manipulation on
> > localtime() output or call `/bin/date` with the correct +FORMAT string.
> >
> > -- MK
> > --
> > To unsubscribe, go to http://mlug.missouri.edu/members/edit.php
> >
> > Archives are available at http://mlug.missouri.edu/list-archives/
> >
> 
> --
> To unsubscribe, go to http://mlug.missouri.edu/members/edit.php
> 
> Archives are available at http://mlug.missouri.edu/list-archives/
--
To unsubscribe, go to http://mlug.missouri.edu/members/edit.php

Archives are available at http://mlug.missouri.edu/list-archives/