Issue Details (XML | Word | Printable)

Key: CORE-4406
Type: New Feature New Feature
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: Doychin Bondzhev
Votes: 0
Watchers: 2

If you were logged in you would be able to see more operations.
Firebird Core

New built-in functions for working with unix time

Created: 28/Apr/14 07:03 AM   Updated: 28/Apr/14 07:03 AM
Component/s: UDF
Affects Version/s: None
Fix Version/s: None

 Description  « Hide
It will be great if there is a function from_unixtime that will convert unix time stamp in milliseconds to firebird timestamp.

This is a similar function for linux that returns string:

#include <stdio.h>
#include <time.h>
#include <stdlib.h>

char* from_unixtime(long long int*);

char* from_unixtime(t)
long long int *t;
  char* res = (char*)malloc(32);

  long milis = *t % 1000;
  long tt = *t / 1000;

  char tmp[32];
  strftime(tmp, 32, "%Y-%m-%d %H:%M:%S", localtime(&tt));

  sprintf(res, "%s:%d", tmp, milis);

  return res;
    ENTRY_POINT 'from_unixtime' MODULE_NAME 'unixTime';

There is similar function in MySQL.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.