I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 0.56
sub units 16.47
+
0
UnitsTime

now

Returns the current date and time as a serial Julian date and time. Excel: NOW
Controller: CodeCogs

get GPL add to cart

Dependents

Info

Interface

C++
HTML

Now

 
doublenowsummerTimeRegionRegion = st_Local )
Returns the current date and time as a serial Julian date, with time expressed as a fraction of the overall (24hr day), i.e. where hours, minutes and seconds are derived from the local system time. This function then uses summerTime to make appropriate adjustment for summer daylight saving.

Example 1

#include <stdio.h>
#include <codecogs/units/time/now.h>
#include <codecogs/units/date/day.h>
#include <codecogs/units/date/month_str.h>
#include <codecogs/units/date/month.h>
#include <codecogs/units/date/year.h>
#include <codecogs/units/time/hour.h>
#include <codecogs/units/time/minute.h>
#include <codecogs/units/time/second.h>
 
using namespace Units::Time;
using namespace Units::Date;
 
int main()
{
  double a=now(st_UK);
  printf("\n\n Is is now the %d %s %04d %2d:%02d:%02d",
         day((int)a), month_str(month((int)a)), year((int)a),
         hour(a), minute(a), second(a));
  return 0;
}

  • st_None : Applies no summer time alterations.
  • st_Local: Applies the default local summer time alterations as defined by the C function localtime. This uses country setting of the underlying operating system to detect when summer daylight saving should be applied. We can not guarantee the operation of localtime, so we generally recommend that this option is not used - except were you do not have doubts about the location the program is being run from.

Parameters

Regionis the location or country for which the existence of summer time is required, see summerTimeRegion for codes. For ease, there are two additional options that can be specified:

Authors

Will Bateman (Sep 2004)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.