Operating System - HP-UX
1752754 Members
4796 Online
108789 Solutions
New Discussion юеВ

Re: How to pass the output of a function to the URL parameter of web_url function

 
SOLVED
Go to solution
naveen06
New Member

How to pass the output of a function to the URL parameter of web_url function

Hi Friends,

I am facing an issue with passing the function returned value to a "URL=" parameter of web_url function.

I need to pass the output of date.gettime() method in the URL.for this I am using time_t function to return the value.

ex: web_url("abc.js",
"URL=https://www.abc.com/agent/1289226282/xxx"...);

In this how I can replace 1289226282 with the output of time_t funtion.

Thanks,
Naveen
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor
Solution

Re: How to pass the output of a function to the URL parameter of web_url function

Hi Naveen:

You might use Perl. For example:

# X="URL=https://www.abc.com/agent/1289226282/xxx"

# echo ${X}|perl -MPOSIX -ple 's{\b(\d+)\b}{strftime "%m%d%Y_%H%M%S",localtime($1)}e'
URL=https://www.abc.com/agent/11082010_092442/xxx

Regards!

...JRF...

naveen06
New Member

Re: How to pass the output of a function to the URL parameter of web_url function

Hi James,

Thanks for the solution. Here the getTime() method returns the number of milliseconds since midnight of January 1, 1970 to the specified date. Do you have any methods to calculate this and replace it in "URL=" parameter of web_url funtion.

Thanks
Naveen
James R. Ferguson
Acclaimed Contributor

Re: How to pass the output of a function to the URL parameter of web_url function

HI (again) Naveen:

> Here the getTime() method returns the number of milliseconds since midnight of January 1, 1970 to the specified date. Do you have any methods to calculate this and replace it in "URL=" parameter of web_url funtion.

So it appears that this is Javascript. A Google search for "javascript strftime" yields many hits, among them:

http://hacks.bluesmoon.info/strftime/index.html#intro_sec

Regards!

...JRF...
Steven Schweda
Honored Contributor

Re: How to pass the output of a function to the URL parameter of web_url function

> So it appears that this is Javascript. [...]

Thanks for that. I had been wondering.
(Count on the HP-UX forum for the most
context-free questions, I always say.)